home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: ref3.tex
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text, with CR line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CR]
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [R*ch] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 44 61 74 61 20 6d 6f |\chapter|{Data mo|
|00000010| 64 65 6c 7d 0d 0d 5c 73 | 65 63 74 69 6f 6e 7b 4f |del}..\s|ection{O|
|00000020| 62 6a 65 63 74 73 2c 20 | 76 61 6c 75 65 73 20 61 |bjects, |values a|
|00000030| 6e 64 20 74 79 70 65 73 | 7d 0d 0d 7b 5c 65 6d 20 |nd types|}..{\em |
|00000040| 4f 62 6a 65 63 74 73 7d | 20 61 72 65 20 50 79 74 |Objects}| are Pyt|
|00000050| 68 6f 6e 27 73 20 61 62 | 73 74 72 61 63 74 69 6f |hon's ab|stractio|
|00000060| 6e 20 66 6f 72 20 64 61 | 74 61 2e 20 20 41 6c 6c |n for da|ta. All|
|00000070| 20 64 61 74 61 20 69 6e | 20 61 20 50 79 74 68 6f | data in| a Pytho|
|00000080| 6e 0d 70 72 6f 67 72 61 | 6d 20 69 73 20 72 65 70 |n.progra|m is rep|
|00000090| 72 65 73 65 6e 74 65 64 | 20 62 79 20 6f 62 6a 65 |resented| by obje|
|000000a0| 63 74 73 20 6f 72 20 62 | 79 20 72 65 6c 61 74 69 |cts or b|y relati|
|000000b0| 6f 6e 73 20 62 65 74 77 | 65 65 6e 20 6f 62 6a 65 |ons betw|een obje|
|000000c0| 63 74 73 2e 0d 28 49 6e | 20 61 20 73 65 6e 73 65 |cts..(In| a sense|
|000000d0| 2c 20 61 6e 64 20 69 6e | 20 63 6f 6e 66 6f 72 6d |, and in| conform|
|000000e0| 61 6e 63 65 20 74 6f 20 | 56 6f 6e 20 4e 65 75 6d |ance to |Von Neum|
|000000f0| 61 6e 6e 27 73 20 6d 6f | 64 65 6c 20 6f 66 20 61 |ann's mo|del of a|
|00000100| 0d 60 60 73 74 6f 72 65 | 64 20 70 72 6f 67 72 61 |.``store|d progra|
|00000110| 6d 20 63 6f 6d 70 75 74 | 65 72 27 27 2c 20 63 6f |m comput|er'', co|
|00000120| 64 65 20 69 73 20 61 6c | 73 6f 20 72 65 70 72 65 |de is al|so repre|
|00000130| 73 65 6e 74 65 64 20 62 | 79 20 6f 62 6a 65 63 74 |sented b|y object|
|00000140| 73 2e 29 0d 5c 69 6e 64 | 65 78 7b 6f 62 6a 65 63 |s.).\ind|ex{objec|
|00000150| 74 7d 0d 5c 69 6e 64 65 | 78 7b 64 61 74 61 7d 0d |t}.\inde|x{data}.|
|00000160| 0d 45 76 65 72 79 20 6f | 62 6a 65 63 74 20 68 61 |.Every o|bject ha|
|00000170| 73 20 61 6e 20 69 64 65 | 6e 74 69 74 79 2c 20 61 |s an ide|ntity, a|
|00000180| 20 74 79 70 65 20 61 6e | 64 20 61 20 76 61 6c 75 | type an|d a valu|
|00000190| 65 2e 20 20 41 6e 20 6f | 62 6a 65 63 74 27 73 20 |e. An o|bject's |
|000001a0| 7b 5c 65 6d 0d 69 64 65 | 6e 74 69 74 79 7d 20 6e |{\em.ide|ntity} n|
|000001b0| 65 76 65 72 20 63 68 61 | 6e 67 65 73 20 6f 6e 63 |ever cha|nges onc|
|000001c0| 65 20 69 74 20 68 61 73 | 20 62 65 65 6e 20 63 72 |e it has| been cr|
|000001d0| 65 61 74 65 64 3b 20 79 | 6f 75 20 6d 61 79 20 74 |eated; y|ou may t|
|000001e0| 68 69 6e 6b 20 6f 66 20 | 69 74 0d 61 73 20 74 68 |hink of |it.as th|
|000001f0| 65 20 6f 62 6a 65 63 74 | 27 73 20 61 64 64 72 65 |e object|'s addre|
|00000200| 73 73 20 69 6e 20 6d 65 | 6d 6f 72 79 2e 20 20 41 |ss in me|mory. A|
|00000210| 6e 20 6f 62 6a 65 63 74 | 27 73 20 7b 5c 65 6d 20 |n object|'s {\em |
|00000220| 74 79 70 65 7d 20 69 73 | 20 61 6c 73 6f 0d 75 6e |type} is| also.un|
|00000230| 63 68 61 6e 67 65 61 62 | 6c 65 2e 20 20 49 74 20 |changeab|le. It |
|00000240| 64 65 74 65 72 6d 69 6e | 65 73 20 74 68 65 20 6f |determin|es the o|
|00000250| 70 65 72 61 74 69 6f 6e | 73 20 74 68 61 74 20 61 |peration|s that a|
|00000260| 6e 20 6f 62 6a 65 63 74 | 20 73 75 70 70 6f 72 74 |n object| support|
|00000270| 73 0d 28 65 2e 67 2e 20 | 60 60 64 6f 65 73 20 69 |s.(e.g. |``does i|
|00000280| 74 20 68 61 76 65 20 61 | 20 6c 65 6e 67 74 68 3f |t have a| length?|
|00000290| 27 27 29 20 61 6e 64 20 | 61 6c 73 6f 20 64 65 66 |'') and |also def|
|000002a0| 69 6e 65 73 20 74 68 65 | 20 70 6f 73 73 69 62 6c |ines the| possibl|
|000002b0| 65 0d 76 61 6c 75 65 73 | 20 66 6f 72 20 6f 62 6a |e.values| for obj|
|000002c0| 65 63 74 73 20 6f 66 20 | 74 68 61 74 20 74 79 70 |ects of |that typ|
|000002d0| 65 2e 20 20 54 68 65 20 | 7b 5c 65 6d 20 76 61 6c |e. The |{\em val|
|000002e0| 75 65 7d 20 6f 66 20 73 | 6f 6d 65 20 6f 62 6a 65 |ue} of s|ome obje|
|000002f0| 63 74 73 20 63 61 6e 0d | 63 68 61 6e 67 65 2e 20 |cts can.|change. |
|00000300| 20 4f 62 6a 65 63 74 73 | 20 77 68 6f 73 65 20 76 | Objects| whose v|
|00000310| 61 6c 75 65 20 63 61 6e | 20 63 68 61 6e 67 65 20 |alue can| change |
|00000320| 61 72 65 20 73 61 69 64 | 20 74 6f 20 62 65 20 7b |are said| to be {|
|00000330| 5c 65 6d 20 6d 75 74 61 | 62 6c 65 7d 3b 0d 6f 62 |\em muta|ble};.ob|
|00000340| 6a 65 63 74 73 20 77 68 | 6f 73 65 20 76 61 6c 75 |jects wh|ose valu|
|00000350| 65 20 69 73 20 75 6e 63 | 68 61 6e 67 65 61 62 6c |e is unc|hangeabl|
|00000360| 65 20 6f 6e 63 65 20 74 | 68 65 79 20 61 72 65 20 |e once t|hey are |
|00000370| 63 72 65 61 74 65 64 20 | 61 72 65 20 63 61 6c 6c |created |are call|
|00000380| 65 64 0d 7b 5c 65 6d 20 | 69 6d 6d 75 74 61 62 6c |ed.{\em |immutabl|
|00000390| 65 7d 2e 20 20 54 68 65 | 20 74 79 70 65 20 64 65 |e}. The| type de|
|000003a0| 74 65 72 6d 69 6e 65 73 | 20 61 6e 20 6f 62 6a 65 |termines| an obje|
|000003b0| 63 74 27 73 20 28 69 6d | 29 6d 75 74 61 62 69 6c |ct's (im|)mutabil|
|000003c0| 69 74 79 2e 0d 5c 69 6e | 64 65 78 7b 69 64 65 6e |ity..\in|dex{iden|
|000003d0| 74 69 74 79 20 6f 66 20 | 61 6e 20 6f 62 6a 65 63 |tity of |an objec|
|000003e0| 74 7d 0d 5c 69 6e 64 65 | 78 7b 76 61 6c 75 65 20 |t}.\inde|x{value |
|000003f0| 6f 66 20 61 6e 20 6f 62 | 6a 65 63 74 7d 0d 5c 69 |of an ob|ject}.\i|
|00000400| 6e 64 65 78 7b 74 79 70 | 65 20 6f 66 20 61 6e 20 |ndex{typ|e of an |
|00000410| 6f 62 6a 65 63 74 7d 0d | 5c 69 6e 64 65 78 7b 6d |object}.|\index{m|
|00000420| 75 74 61 62 6c 65 20 6f | 62 6a 65 63 74 7d 0d 5c |utable o|bject}.\|
|00000430| 69 6e 64 65 78 7b 69 6d | 6d 75 74 61 62 6c 65 20 |index{im|mutable |
|00000440| 6f 62 6a 65 63 74 7d 0d | 0d 4f 62 6a 65 63 74 73 |object}.|.Objects|
|00000450| 20 61 72 65 20 6e 65 76 | 65 72 20 65 78 70 6c 69 | are nev|er expli|
|00000460| 63 69 74 6c 79 20 64 65 | 73 74 72 6f 79 65 64 3b |citly de|stroyed;|
|00000470| 20 68 6f 77 65 76 65 72 | 2c 20 77 68 65 6e 20 74 | however|, when t|
|00000480| 68 65 79 20 62 65 63 6f | 6d 65 0d 75 6e 72 65 61 |hey beco|me.unrea|
|00000490| 63 68 61 62 6c 65 20 74 | 68 65 79 20 6d 61 79 20 |chable t|hey may |
|000004a0| 62 65 20 67 61 72 62 61 | 67 65 2d 63 6f 6c 6c 65 |be garba|ge-colle|
|000004b0| 63 74 65 64 2e 20 20 41 | 6e 20 69 6d 70 6c 65 6d |cted. A|n implem|
|000004c0| 65 6e 74 61 74 69 6f 6e | 20 69 73 0d 61 6c 6c 6f |entation| is.allo|
|000004d0| 77 65 64 20 74 6f 20 64 | 65 6c 61 79 20 67 61 72 |wed to d|elay gar|
|000004e0| 62 61 67 65 20 63 6f 6c | 6c 65 63 74 69 6f 6e 20 |bage col|lection |
|000004f0| 6f 72 20 6f 6d 69 74 20 | 69 74 20 61 6c 74 6f 67 |or omit |it altog|
|00000500| 65 74 68 65 72 20 2d 2d | 2d 20 69 74 20 69 73 20 |ether --|- it is |
|00000510| 61 0d 6d 61 74 74 65 72 | 20 6f 66 20 69 6d 70 6c |a.matter| of impl|
|00000520| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 71 75 61 6c 69 |ementati|on quali|
|00000530| 74 79 20 68 6f 77 20 67 | 61 72 62 61 67 65 20 63 |ty how g|arbage c|
|00000540| 6f 6c 6c 65 63 74 69 6f | 6e 20 69 73 0d 69 6d 70 |ollectio|n is.imp|
|00000550| 6c 65 6d 65 6e 74 65 64 | 2c 20 61 73 20 6c 6f 6e |lemented|, as lon|
|00000560| 67 20 61 73 20 6e 6f 20 | 6f 62 6a 65 63 74 73 20 |g as no |objects |
|00000570| 61 72 65 20 63 6f 6c 6c | 65 63 74 65 64 20 74 68 |are coll|ected th|
|00000580| 61 74 20 61 72 65 20 73 | 74 69 6c 6c 0d 72 65 61 |at are s|till.rea|
|00000590| 63 68 61 62 6c 65 2e 20 | 20 28 49 6d 70 6c 65 6d |chable. | (Implem|
|000005a0| 65 6e 74 61 74 69 6f 6e | 20 6e 6f 74 65 3a 20 74 |entation| note: t|
|000005b0| 68 65 20 63 75 72 72 65 | 6e 74 20 69 6d 70 6c 65 |he curre|nt imple|
|000005c0| 6d 65 6e 74 61 74 69 6f | 6e 20 75 73 65 73 20 61 |mentatio|n uses a|
|000005d0| 0d 72 65 66 65 72 65 6e | 63 65 2d 63 6f 75 6e 74 |.referen|ce-count|
|000005e0| 69 6e 67 20 73 63 68 65 | 6d 65 20 77 68 69 63 68 |ing sche|me which|
|000005f0| 20 63 6f 6c 6c 65 63 74 | 73 20 6d 6f 73 74 20 6f | collect|s most o|
|00000600| 62 6a 65 63 74 73 20 61 | 73 20 73 6f 6f 6e 20 61 |bjects a|s soon a|
|00000610| 73 20 74 68 65 79 0d 62 | 65 63 6f 6d 65 20 75 6e |s they.b|ecome un|
|00000620| 72 65 61 63 68 61 62 6c | 65 2c 20 62 75 74 20 6e |reachabl|e, but n|
|00000630| 65 76 65 72 20 63 6f 6c | 6c 65 63 74 73 20 67 61 |ever col|lects ga|
|00000640| 72 62 61 67 65 20 63 6f | 6e 74 61 69 6e 69 6e 67 |rbage co|ntaining|
|00000650| 20 63 69 72 63 75 6c 61 | 72 0d 72 65 66 65 72 65 | circula|r.refere|
|00000660| 6e 63 65 73 2e 29 0d 5c | 69 6e 64 65 78 7b 67 61 |nces.).\|index{ga|
|00000670| 72 62 61 67 65 20 63 6f | 6c 6c 65 63 74 69 6f 6e |rbage co|llection|
|00000680| 7d 0d 5c 69 6e 64 65 78 | 7b 72 65 66 65 72 65 6e |}.\index|{referen|
|00000690| 63 65 20 63 6f 75 6e 74 | 69 6e 67 7d 0d 5c 69 6e |ce count|ing}.\in|
|000006a0| 64 65 78 7b 75 6e 72 65 | 61 63 68 61 62 6c 65 20 |dex{unre|achable |
|000006b0| 6f 62 6a 65 63 74 7d 0d | 0d 4e 6f 74 65 20 74 68 |object}.|.Note th|
|000006c0| 61 74 20 74 68 65 20 75 | 73 65 20 6f 66 20 74 68 |at the u|se of th|
|000006d0| 65 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |e implem|entation|
|000006e0| 27 73 20 74 72 61 63 69 | 6e 67 20 6f 72 20 64 65 |'s traci|ng or de|
|000006f0| 62 75 67 67 69 6e 67 0d | 66 61 63 69 6c 69 74 69 |bugging.|faciliti|
|00000700| 65 73 20 6d 61 79 20 6b | 65 65 70 20 6f 62 6a 65 |es may k|eep obje|
|00000710| 63 74 73 20 61 6c 69 76 | 65 20 74 68 61 74 20 77 |cts aliv|e that w|
|00000720| 6f 75 6c 64 20 6e 6f 72 | 6d 61 6c 6c 79 20 62 65 |ould nor|mally be|
|00000730| 20 63 6f 6c 6c 65 63 74 | 61 62 6c 65 2e 0d 0d 53 | collect|able...S|
|00000740| 6f 6d 65 20 6f 62 6a 65 | 63 74 73 20 63 6f 6e 74 |ome obje|cts cont|
|00000750| 61 69 6e 20 72 65 66 65 | 72 65 6e 63 65 73 20 74 |ain refe|rences t|
|00000760| 6f 20 60 60 65 78 74 65 | 72 6e 61 6c 27 27 20 72 |o ``exte|rnal'' r|
|00000770| 65 73 6f 75 72 63 65 73 | 20 73 75 63 68 20 61 73 |esources| such as|
|00000780| 20 6f 70 65 6e 0d 66 69 | 6c 65 73 20 6f 72 20 77 | open.fi|les or w|
|00000790| 69 6e 64 6f 77 73 2e 20 | 20 49 74 20 69 73 20 75 |indows. | It is u|
|000007a0| 6e 64 65 72 73 74 6f 6f | 64 20 74 68 61 74 20 74 |nderstoo|d that t|
|000007b0| 68 65 73 65 20 72 65 73 | 6f 75 72 63 65 73 20 61 |hese res|ources a|
|000007c0| 72 65 20 66 72 65 65 64 | 0d 77 68 65 6e 20 74 68 |re freed|.when th|
|000007d0| 65 20 6f 62 6a 65 63 74 | 20 69 73 20 67 61 72 62 |e object| is garb|
|000007e0| 61 67 65 2d 63 6f 6c 6c | 65 63 74 65 64 2c 20 62 |age-coll|ected, b|
|000007f0| 75 74 20 73 69 6e 63 65 | 20 67 61 72 62 61 67 65 |ut since| garbage|
|00000800| 20 63 6f 6c 6c 65 63 74 | 69 6f 6e 20 69 73 0d 6e | collect|ion is.n|
|00000810| 6f 74 20 67 75 61 72 61 | 6e 74 65 65 64 20 74 6f |ot guara|nteed to|
|00000820| 20 68 61 70 70 65 6e 2c | 20 73 75 63 68 20 6f 62 | happen,| such ob|
|00000830| 6a 65 63 74 73 20 61 6c | 73 6f 20 70 72 6f 76 69 |jects al|so provi|
|00000840| 64 65 20 61 6e 20 65 78 | 70 6c 69 63 69 74 20 77 |de an ex|plicit w|
|00000850| 61 79 20 74 6f 0d 72 65 | 6c 65 61 73 65 20 74 68 |ay to.re|lease th|
|00000860| 65 20 65 78 74 65 72 6e | 61 6c 20 72 65 73 6f 75 |e extern|al resou|
|00000870| 72 63 65 2c 20 75 73 75 | 61 6c 6c 79 20 61 20 5c |rce, usu|ally a \|
|00000880| 76 65 72 62 40 63 6c 6f | 73 65 40 20 6d 65 74 68 |verb@clo|se@ meth|
|00000890| 6f 64 2e 0d 50 72 6f 67 | 72 61 6d 73 20 61 72 65 |od..Prog|rams are|
|000008a0| 20 73 74 72 6f 6e 67 6c | 79 20 72 65 63 6f 6d 6d | strongl|y recomm|
|000008b0| 65 6e 64 65 64 20 74 6f | 20 61 6c 77 61 79 73 20 |ended to| always |
|000008c0| 65 78 70 6c 69 63 69 74 | 6c 79 20 63 6c 6f 73 65 |explicit|ly close|
|000008d0| 20 73 75 63 68 0d 6f 62 | 6a 65 63 74 73 2e 0d 0d | such.ob|jects...|
|000008e0| 53 6f 6d 65 20 6f 62 6a | 65 63 74 73 20 63 6f 6e |Some obj|ects con|
|000008f0| 74 61 69 6e 20 72 65 66 | 65 72 65 6e 63 65 73 20 |tain ref|erences |
|00000900| 74 6f 20 6f 74 68 65 72 | 20 6f 62 6a 65 63 74 73 |to other| objects|
|00000910| 3b 20 74 68 65 73 65 20 | 61 72 65 20 63 61 6c 6c |; these |are call|
|00000920| 65 64 0d 7b 5c 65 6d 20 | 63 6f 6e 74 61 69 6e 65 |ed.{\em |containe|
|00000930| 72 73 7d 2e 20 20 45 78 | 61 6d 70 6c 65 73 20 6f |rs}. Ex|amples o|
|00000940| 66 20 63 6f 6e 74 61 69 | 6e 65 72 73 20 61 72 65 |f contai|ners are|
|00000950| 20 74 75 70 6c 65 73 2c | 20 6c 69 73 74 73 20 61 | tuples,| lists a|
|00000960| 6e 64 0d 64 69 63 74 69 | 6f 6e 61 72 69 65 73 2e |nd.dicti|onaries.|
|00000970| 20 20 54 68 65 20 72 65 | 66 65 72 65 6e 63 65 73 | The re|ferences|
|00000980| 20 61 72 65 20 70 61 72 | 74 20 6f 66 20 61 20 63 | are par|t of a c|
|00000990| 6f 6e 74 61 69 6e 65 72 | 27 73 20 76 61 6c 75 65 |ontainer|'s value|
|000009a0| 2e 20 20 49 6e 0d 6d 6f | 73 74 20 63 61 73 65 73 |. In.mo|st cases|
|000009b0| 2c 20 77 68 65 6e 20 77 | 65 20 74 61 6c 6b 20 61 |, when w|e talk a|
|000009c0| 62 6f 75 74 20 74 68 65 | 20 76 61 6c 75 65 20 6f |bout the| value o|
|000009d0| 66 20 61 20 63 6f 6e 74 | 61 69 6e 65 72 2c 20 77 |f a cont|ainer, w|
|000009e0| 65 20 69 6d 70 6c 79 20 | 74 68 65 0d 76 61 6c 75 |e imply |the.valu|
|000009f0| 65 73 2c 20 6e 6f 74 20 | 74 68 65 20 69 64 65 6e |es, not |the iden|
|00000a00| 74 69 74 69 65 73 20 6f | 66 20 74 68 65 20 63 6f |tities o|f the co|
|00000a10| 6e 74 61 69 6e 65 64 20 | 6f 62 6a 65 63 74 73 3b |ntained |objects;|
|00000a20| 20 68 6f 77 65 76 65 72 | 2c 20 77 68 65 6e 20 77 | however|, when w|
|00000a30| 65 0d 74 61 6c 6b 20 61 | 62 6f 75 74 20 74 68 65 |e.talk a|bout the|
|00000a40| 20 28 69 6d 29 6d 75 74 | 61 62 69 6c 69 74 79 20 | (im)mut|ability |
|00000a50| 6f 66 20 61 20 63 6f 6e | 74 61 69 6e 65 72 2c 20 |of a con|tainer, |
|00000a60| 6f 6e 6c 79 20 74 68 65 | 20 69 64 65 6e 74 69 74 |only the| identit|
|00000a70| 69 65 73 20 6f 66 0d 74 | 68 65 20 69 6d 6d 65 64 |ies of.t|he immed|
|00000a80| 69 61 74 65 6c 79 20 63 | 6f 6e 74 61 69 6e 65 64 |iately c|ontained|
|00000a90| 20 6f 62 6a 65 63 74 73 | 20 61 72 65 20 69 6d 70 | objects| are imp|
|00000aa0| 6c 69 65 64 2e 20 20 28 | 53 6f 2c 20 69 66 20 61 |lied. (|So, if a|
|00000ab0| 6e 20 69 6d 6d 75 74 61 | 62 6c 65 0d 63 6f 6e 74 |n immuta|ble.cont|
|00000ac0| 61 69 6e 65 72 20 63 6f | 6e 74 61 69 6e 73 20 61 |ainer co|ntains a|
|00000ad0| 20 72 65 66 65 72 65 6e | 63 65 20 74 6f 20 61 20 | referen|ce to a |
|00000ae0| 6d 75 74 61 62 6c 65 20 | 6f 62 6a 65 63 74 2c 20 |mutable |object, |
|00000af0| 69 74 73 20 76 61 6c 75 | 65 20 63 68 61 6e 67 65 |its valu|e change|
|00000b00| 73 0d 69 66 20 74 68 61 | 74 20 6d 75 74 61 62 6c |s.if tha|t mutabl|
|00000b10| 65 20 6f 62 6a 65 63 74 | 20 69 73 20 63 68 61 6e |e object| is chan|
|00000b20| 67 65 64 2e 29 0d 5c 69 | 6e 64 65 78 7b 63 6f 6e |ged.).\i|ndex{con|
|00000b30| 74 61 69 6e 65 72 7d 0d | 0d 54 79 70 65 73 20 61 |tainer}.|.Types a|
|00000b40| 66 66 65 63 74 20 61 6c | 6d 6f 73 74 20 61 6c 6c |ffect al|most all|
|00000b50| 20 61 73 70 65 63 74 73 | 20 6f 66 20 6f 62 6a 65 | aspects| of obje|
|00000b60| 63 74 73 27 20 6c 69 76 | 65 73 2e 20 20 45 76 65 |cts' liv|es. Eve|
|00000b70| 6e 20 74 68 65 20 6d 65 | 61 6e 69 6e 67 0d 6f 66 |n the me|aning.of|
|00000b80| 20 6f 62 6a 65 63 74 20 | 69 64 65 6e 74 69 74 79 | object |identity|
|00000b90| 20 69 73 20 61 66 66 65 | 63 74 65 64 20 69 6e 20 | is affe|cted in |
|00000ba0| 73 6f 6d 65 20 73 65 6e | 73 65 3a 20 66 6f 72 20 |some sen|se: for |
|00000bb0| 69 6d 6d 75 74 61 62 6c | 65 20 74 79 70 65 73 2c |immutabl|e types,|
|00000bc0| 0d 6f 70 65 72 61 74 69 | 6f 6e 73 20 74 68 61 74 |.operati|ons that|
|00000bd0| 20 63 6f 6d 70 75 74 65 | 20 6e 65 77 20 76 61 6c | compute| new val|
|00000be0| 75 65 73 20 6d 61 79 20 | 61 63 74 75 61 6c 6c 79 |ues may |actually|
|00000bf0| 20 72 65 74 75 72 6e 20 | 61 20 72 65 66 65 72 65 | return |a refere|
|00000c00| 6e 63 65 20 74 6f 0d 61 | 6e 79 20 65 78 69 73 74 |nce to.a|ny exist|
|00000c10| 69 6e 67 20 6f 62 6a 65 | 63 74 20 77 69 74 68 20 |ing obje|ct with |
|00000c20| 74 68 65 20 73 61 6d 65 | 20 74 79 70 65 20 61 6e |the same| type an|
|00000c30| 64 20 76 61 6c 75 65 2c | 20 77 68 69 6c 65 20 66 |d value,| while f|
|00000c40| 6f 72 20 6d 75 74 61 62 | 6c 65 0d 6f 62 6a 65 63 |or mutab|le.objec|
|00000c50| 74 73 20 74 68 69 73 20 | 69 73 20 6e 6f 74 20 61 |ts this |is not a|
|00000c60| 6c 6c 6f 77 65 64 2e 20 | 20 45 2e 67 2e 20 61 66 |llowed. | E.g. af|
|00000c70| 74 65 72 0d 0d 5c 62 65 | 67 69 6e 7b 76 65 72 62 |ter..\be|gin{verb|
|00000c80| 61 74 69 6d 7d 0d 61 20 | 3d 20 31 3b 20 62 20 3d |atim}.a |= 1; b =|
|00000c90| 20 31 3b 20 63 20 3d 20 | 5b 5d 3b 20 64 20 3d 20 | 1; c = |[]; d = |
|00000ca0| 5b 5d 0d 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |[].\end{|verbatim|
|00000cb0| 7d 0d 0d 5c 76 65 72 62 | 40 61 40 20 61 6e 64 20 |}..\verb|@a@ and |
|00000cc0| 5c 76 65 72 62 40 62 40 | 20 6d 61 79 20 6f 72 20 |\verb@b@| may or |
|00000cd0| 6d 61 79 20 6e 6f 74 20 | 72 65 66 65 72 20 74 6f |may not |refer to|
|00000ce0| 20 74 68 65 20 73 61 6d | 65 20 6f 62 6a 65 63 74 | the sam|e object|
|00000cf0| 20 77 69 74 68 20 74 68 | 65 0d 76 61 6c 75 65 20 | with th|e.value |
|00000d00| 6f 6e 65 2c 20 64 65 70 | 65 6e 64 69 6e 67 20 6f |one, dep|ending o|
|00000d10| 6e 20 74 68 65 20 69 6d | 70 6c 65 6d 65 6e 74 61 |n the im|plementa|
|00000d20| 74 69 6f 6e 2c 20 62 75 | 74 20 5c 76 65 72 62 40 |tion, bu|t \verb@|
|00000d30| 63 40 20 61 6e 64 20 5c | 76 65 72 62 40 64 40 0d |c@ and \|verb@d@.|
|00000d40| 61 72 65 20 67 75 61 72 | 61 6e 74 65 65 64 20 74 |are guar|anteed t|
|00000d50| 6f 20 72 65 66 65 72 20 | 74 6f 20 74 77 6f 20 64 |o refer |to two d|
|00000d60| 69 66 66 65 72 65 6e 74 | 2c 20 75 6e 69 71 75 65 |ifferent|, unique|
|00000d70| 2c 20 6e 65 77 6c 79 20 | 63 72 65 61 74 65 64 20 |, newly |created |
|00000d80| 65 6d 70 74 79 0d 6c 69 | 73 74 73 2e 0d 0d 5c 73 |empty.li|sts...\s|
|00000d90| 65 63 74 69 6f 6e 7b 54 | 68 65 20 73 74 61 6e 64 |ection{T|he stand|
|00000da0| 61 72 64 20 74 79 70 65 | 20 68 69 65 72 61 72 63 |ard type| hierarc|
|00000db0| 68 79 7d 20 5c 6c 61 62 | 65 6c 7b 74 79 70 65 73 |hy} \lab|el{types|
|00000dc0| 7d 0d 0d 42 65 6c 6f 77 | 20 69 73 20 61 20 6c 69 |}..Below| is a li|
|00000dd0| 73 74 20 6f 66 20 74 68 | 65 20 74 79 70 65 73 20 |st of th|e types |
|00000de0| 74 68 61 74 20 61 72 65 | 20 62 75 69 6c 74 20 69 |that are| built i|
|00000df0| 6e 74 6f 20 50 79 74 68 | 6f 6e 2e 20 20 45 78 74 |nto Pyth|on. Ext|
|00000e00| 65 6e 73 69 6f 6e 0d 6d | 6f 64 75 6c 65 73 20 77 |ension.m|odules w|
|00000e10| 72 69 74 74 65 6e 20 69 | 6e 20 43 20 63 61 6e 20 |ritten i|n C can |
|00000e20| 64 65 66 69 6e 65 20 61 | 64 64 69 74 69 6f 6e 61 |define a|dditiona|
|00000e30| 6c 20 74 79 70 65 73 2e | 20 20 46 75 74 75 72 65 |l types.| Future|
|00000e40| 20 76 65 72 73 69 6f 6e | 73 20 6f 66 0d 50 79 74 | version|s of.Pyt|
|00000e50| 68 6f 6e 20 6d 61 79 20 | 61 64 64 20 74 79 70 65 |hon may |add type|
|00000e60| 73 20 74 6f 20 74 68 65 | 20 74 79 70 65 20 68 69 |s to the| type hi|
|00000e70| 65 72 61 72 63 68 79 20 | 28 65 2e 67 2e 20 72 61 |erarchy |(e.g. ra|
|00000e80| 74 69 6f 6e 61 6c 20 6f | 72 20 63 6f 6d 70 6c 65 |tional o|r comple|
|00000e90| 78 0d 6e 75 6d 62 65 72 | 73 2c 20 65 66 66 69 63 |x.number|s, effic|
|00000ea0| 69 65 6e 74 6c 79 20 73 | 74 6f 72 65 64 20 61 72 |iently s|tored ar|
|00000eb0| 72 61 79 73 20 6f 66 20 | 69 6e 74 65 67 65 72 73 |rays of |integers|
|00000ec0| 2c 20 65 74 63 2e 29 2e | 0d 5c 69 6e 64 65 78 7b |, etc.).|.\index{|
|00000ed0| 74 79 70 65 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 64 |type}.\i|ndexii{d|
|00000ee0| 61 74 61 7d 7b 74 79 70 | 65 7d 0d 5c 69 6e 64 65 |ata}{typ|e}.\inde|
|00000ef0| 78 69 69 7b 74 79 70 65 | 7d 7b 68 69 65 72 61 72 |xii{type|}{hierar|
|00000f00| 63 68 79 7d 0d 5c 69 6e | 64 65 78 69 69 7b 65 78 |chy}.\in|dexii{ex|
|00000f10| 74 65 6e 73 69 6f 6e 7d | 7b 6d 6f 64 75 6c 65 7d |tension}|{module}|
|00000f20| 0d 5c 69 6e 64 65 78 7b | 43 7d 0d 0d 53 6f 6d 65 |.\index{|C}..Some|
|00000f30| 20 6f 66 20 74 68 65 20 | 74 79 70 65 20 64 65 73 | of the |type des|
|00000f40| 63 72 69 70 74 69 6f 6e | 73 20 62 65 6c 6f 77 20 |cription|s below |
|00000f50| 63 6f 6e 74 61 69 6e 20 | 61 20 70 61 72 61 67 72 |contain |a paragr|
|00000f60| 61 70 68 20 6c 69 73 74 | 69 6e 67 0d 60 73 70 65 |aph list|ing.`spe|
|00000f70| 63 69 61 6c 20 61 74 74 | 72 69 62 75 74 65 73 27 |cial att|ributes'|
|00000f80| 2e 20 20 54 68 65 73 65 | 20 61 72 65 20 61 74 74 |. These| are att|
|00000f90| 72 69 62 75 74 65 73 20 | 74 68 61 74 20 70 72 6f |ributes |that pro|
|00000fa0| 76 69 64 65 20 61 63 63 | 65 73 73 20 74 6f 20 74 |vide acc|ess to t|
|00000fb0| 68 65 0d 69 6d 70 6c 65 | 6d 65 6e 74 61 74 69 6f |he.imple|mentatio|
|00000fc0| 6e 20 61 6e 64 20 61 72 | 65 20 6e 6f 74 20 69 6e |n and ar|e not in|
|00000fd0| 74 65 6e 64 65 64 20 66 | 6f 72 20 67 65 6e 65 72 |tended f|or gener|
|00000fe0| 61 6c 20 75 73 65 2e 20 | 20 54 68 65 69 72 20 64 |al use. | Their d|
|00000ff0| 65 66 69 6e 69 74 69 6f | 6e 0d 6d 61 79 20 63 68 |efinitio|n.may ch|
|00001000| 61 6e 67 65 20 69 6e 20 | 74 68 65 20 66 75 74 75 |ange in |the futu|
|00001010| 72 65 2e 20 20 54 68 65 | 72 65 20 61 72 65 20 61 |re. The|re are a|
|00001020| 6c 73 6f 20 73 6f 6d 65 | 20 60 67 65 6e 65 72 69 |lso some| `generi|
|00001030| 63 27 20 73 70 65 63 69 | 61 6c 0d 61 74 74 72 69 |c' speci|al.attri|
|00001040| 62 75 74 65 73 2c 20 6e | 6f 74 20 6c 69 73 74 65 |butes, n|ot liste|
|00001050| 64 20 77 69 74 68 20 74 | 68 65 20 69 6e 64 69 76 |d with t|he indiv|
|00001060| 69 64 75 61 6c 20 6f 62 | 6a 65 63 74 73 3a 20 5c |idual ob|jects: \|
|00001070| 76 65 72 62 40 5f 5f 6d | 65 74 68 6f 64 73 5f 5f |verb@__m|ethods__|
|00001080| 40 0d 69 73 20 61 20 6c | 69 73 74 20 6f 66 20 74 |@.is a l|ist of t|
|00001090| 68 65 20 6d 65 74 68 6f | 64 20 6e 61 6d 65 73 20 |he metho|d names |
|000010a0| 6f 66 20 61 20 62 75 69 | 6c 74 2d 69 6e 20 6f 62 |of a bui|lt-in ob|
|000010b0| 6a 65 63 74 2c 20 69 66 | 20 69 74 20 68 61 73 20 |ject, if| it has |
|000010c0| 61 6e 79 3b 0d 5c 76 65 | 72 62 40 5f 5f 6d 65 6d |any;.\ve|rb@__mem|
|000010d0| 62 65 72 73 5f 5f 40 20 | 69 73 20 61 20 6c 69 73 |bers__@ |is a lis|
|000010e0| 74 20 6f 66 20 74 68 65 | 20 64 61 74 61 20 61 74 |t of the| data at|
|000010f0| 74 72 69 62 75 74 65 20 | 6e 61 6d 65 73 20 6f 66 |tribute |names of|
|00001100| 20 61 20 62 75 69 6c 74 | 2d 69 6e 0d 6f 62 6a 65 | a built|-in.obje|
|00001110| 63 74 2c 20 69 66 20 69 | 74 20 68 61 73 20 61 6e |ct, if i|t has an|
|00001120| 79 2e 0d 5c 69 6e 64 65 | 78 7b 61 74 74 72 69 62 |y..\inde|x{attrib|
|00001130| 75 74 65 7d 0d 5c 69 6e | 64 65 78 69 69 7b 73 70 |ute}.\in|dexii{sp|
|00001140| 65 63 69 61 6c 7d 7b 61 | 74 74 72 69 62 75 74 65 |ecial}{a|ttribute|
|00001150| 7d 0d 5c 69 6e 64 65 78 | 69 69 69 7b 67 65 6e 65 |}.\index|iii{gene|
|00001160| 72 69 63 7d 7b 73 70 65 | 63 69 61 6c 7d 7b 61 74 |ric}{spe|cial}{at|
|00001170| 74 72 69 62 75 74 65 7d | 0d 5c 74 74 69 6e 64 65 |tribute}|.\ttinde|
|00001180| 78 7b 5f 5f 6d 65 74 68 | 6f 64 73 5f 5f 7d 0d 5c |x{__meth|ods__}.\|
|00001190| 74 74 69 6e 64 65 78 7b | 5f 5f 6d 65 6d 62 65 72 |ttindex{|__member|
|000011a0| 73 5f 5f 7d 0d 0d 5c 62 | 65 67 69 6e 7b 64 65 73 |s__}..\b|egin{des|
|000011b0| 63 72 69 70 74 69 6f 6e | 7d 0d 0d 5c 69 74 65 6d |cription|}..\item|
|000011c0| 5b 4e 6f 6e 65 5d 0d 54 | 68 69 73 20 74 79 70 65 |[None].T|his type|
|000011d0| 20 68 61 73 20 61 20 73 | 69 6e 67 6c 65 20 76 61 | has a s|ingle va|
|000011e0| 6c 75 65 2e 20 20 54 68 | 65 72 65 20 69 73 20 61 |lue. Th|ere is a|
|000011f0| 20 73 69 6e 67 6c 65 20 | 6f 62 6a 65 63 74 20 77 | single |object w|
|00001200| 69 74 68 20 74 68 69 73 | 20 76 61 6c 75 65 2e 0d |ith this| value..|
|00001210| 54 68 69 73 20 6f 62 6a | 65 63 74 20 69 73 20 61 |This obj|ect is a|
|00001220| 63 63 65 73 73 65 64 20 | 74 68 72 6f 75 67 68 20 |ccessed |through |
|00001230| 74 68 65 20 62 75 69 6c | 74 2d 69 6e 20 6e 61 6d |the buil|t-in nam|
|00001240| 65 20 5c 76 65 72 62 40 | 4e 6f 6e 65 40 2e 0d 49 |e \verb@|None@..I|
|00001250| 74 20 69 73 20 72 65 74 | 75 72 6e 65 64 20 66 72 |t is ret|urned fr|
|00001260| 6f 6d 20 66 75 6e 63 74 | 69 6f 6e 73 20 74 68 61 |om funct|ions tha|
|00001270| 74 20 64 6f 6e 27 74 20 | 65 78 70 6c 69 63 69 74 |t don't |explicit|
|00001280| 6c 79 20 72 65 74 75 72 | 6e 20 61 6e 20 6f 62 6a |ly retur|n an obj|
|00001290| 65 63 74 2e 0d 5c 74 74 | 69 6e 64 65 78 7b 4e 6f |ect..\tt|index{No|
|000012a0| 6e 65 7d 0d 5c 6f 62 69 | 6e 64 65 78 7b 4e 6f 6e |ne}.\obi|ndex{Non|
|000012b0| 65 40 7b 5c 74 74 20 4e | 6f 6e 65 7d 7d 0d 0d 5c |e@{\tt N|one}}..\|
|000012c0| 69 74 65 6d 5b 4e 75 6d | 62 65 72 73 5d 0d 54 68 |item[Num|bers].Th|
|000012d0| 65 73 65 20 61 72 65 20 | 63 72 65 61 74 65 64 20 |ese are |created |
|000012e0| 62 79 20 6e 75 6d 65 72 | 69 63 20 6c 69 74 65 72 |by numer|ic liter|
|000012f0| 61 6c 73 20 61 6e 64 20 | 72 65 74 75 72 6e 65 64 |als and |returned|
|00001300| 20 61 73 20 72 65 73 75 | 6c 74 73 20 62 79 0d 61 | as resu|lts by.a|
|00001310| 72 69 74 68 6d 65 74 69 | 63 20 6f 70 65 72 61 74 |rithmeti|c operat|
|00001320| 6f 72 73 20 61 6e 64 20 | 61 72 69 74 68 6d 65 74 |ors and |arithmet|
|00001330| 69 63 20 62 75 69 6c 74 | 2d 69 6e 20 66 75 6e 63 |ic built|-in func|
|00001340| 74 69 6f 6e 73 2e 20 20 | 4e 75 6d 65 72 69 63 0d |tions. |Numeric.|
|00001350| 6f 62 6a 65 63 74 73 20 | 61 72 65 20 69 6d 6d 75 |objects |are immu|
|00001360| 74 61 62 6c 65 3b 20 6f | 6e 63 65 20 63 72 65 61 |table; o|nce crea|
|00001370| 74 65 64 20 74 68 65 69 | 72 20 76 61 6c 75 65 20 |ted thei|r value |
|00001380| 6e 65 76 65 72 20 63 68 | 61 6e 67 65 73 2e 20 20 |never ch|anges. |
|00001390| 50 79 74 68 6f 6e 0d 6e | 75 6d 62 65 72 73 20 61 |Python.n|umbers a|
|000013a0| 72 65 20 6f 66 20 63 6f | 75 72 73 65 20 73 74 72 |re of co|urse str|
|000013b0| 6f 6e 67 6c 79 20 72 65 | 6c 61 74 65 64 20 74 6f |ongly re|lated to|
|000013c0| 20 6d 61 74 68 65 6d 61 | 74 69 63 61 6c 20 6e 75 | mathema|tical nu|
|000013d0| 6d 62 65 72 73 2c 20 62 | 75 74 0d 73 75 62 6a 65 |mbers, b|ut.subje|
|000013e0| 63 74 20 74 6f 20 74 68 | 65 20 6c 69 6d 69 74 61 |ct to th|e limita|
|000013f0| 74 69 6f 6e 73 20 6f 66 | 20 6e 75 6d 65 72 69 63 |tions of| numeric|
|00001400| 61 6c 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |al repre|sentatio|
|00001410| 6e 20 69 6e 20 63 6f 6d | 70 75 74 65 72 73 2e 0d |n in com|puters..|
|00001420| 5c 6f 62 69 6e 64 65 78 | 7b 6e 75 6d 62 65 72 7d |\obindex|{number}|
|00001430| 0d 5c 6f 62 69 6e 64 65 | 78 7b 6e 75 6d 65 72 69 |.\obinde|x{numeri|
|00001440| 63 7d 0d 0d 50 79 74 68 | 6f 6e 20 64 69 73 74 69 |c}..Pyth|on disti|
|00001450| 6e 67 75 69 73 68 65 73 | 20 62 65 74 77 65 65 6e |nguishes| between|
|00001460| 20 69 6e 74 65 67 65 72 | 73 20 61 6e 64 20 66 6c | integer|s and fl|
|00001470| 6f 61 74 69 6e 67 20 70 | 6f 69 6e 74 20 6e 75 6d |oating p|oint num|
|00001480| 62 65 72 73 3a 0d 0d 5c | 62 65 67 69 6e 7b 64 65 |bers:..\|begin{de|
|00001490| 73 63 72 69 70 74 69 6f | 6e 7d 0d 5c 69 74 65 6d |scriptio|n}.\item|
|000014a0| 5b 49 6e 74 65 67 65 72 | 73 5d 0d 54 68 65 73 65 |[Integer|s].These|
|000014b0| 20 72 65 70 72 65 73 65 | 6e 74 20 65 6c 65 6d 65 | represe|nt eleme|
|000014c0| 6e 74 73 20 66 72 6f 6d | 20 74 68 65 20 6d 61 74 |nts from| the mat|
|000014d0| 68 65 6d 61 74 69 63 61 | 6c 20 73 65 74 20 6f 66 |hematica|l set of|
|000014e0| 20 77 68 6f 6c 65 20 6e | 75 6d 62 65 72 73 2e 0d | whole n|umbers..|
|000014f0| 5c 6f 62 69 6e 64 65 78 | 7b 69 6e 74 65 67 65 72 |\obindex|{integer|
|00001500| 7d 0d 0d 54 68 65 72 65 | 20 61 72 65 20 74 77 6f |}..There| are two|
|00001510| 20 74 79 70 65 73 20 6f | 66 20 69 6e 74 65 67 65 | types o|f intege|
|00001520| 72 73 3a 0d 0d 5c 62 65 | 67 69 6e 7b 64 65 73 63 |rs:..\be|gin{desc|
|00001530| 72 69 70 74 69 6f 6e 7d | 0d 0d 5c 69 74 65 6d 5b |ription}|..\item[|
|00001540| 50 6c 61 69 6e 20 69 6e | 74 65 67 65 72 73 5d 0d |Plain in|tegers].|
|00001550| 54 68 65 73 65 20 72 65 | 70 72 65 73 65 6e 74 20 |These re|present |
|00001560| 6e 75 6d 62 65 72 73 20 | 69 6e 20 74 68 65 20 72 |numbers |in the r|
|00001570| 61 6e 67 65 20 24 2d 32 | 5e 7b 33 31 7d 24 20 74 |ange $-2|^{31}$ t|
|00001580| 68 72 6f 75 67 68 20 24 | 32 5e 7b 33 31 7d 2d 31 |hrough $|2^{31}-1|
|00001590| 24 2e 0d 28 54 68 65 20 | 72 61 6e 67 65 20 6d 61 |$..(The |range ma|
|000015a0| 79 20 62 65 20 6c 61 72 | 67 65 72 20 6f 6e 20 6d |y be lar|ger on m|
|000015b0| 61 63 68 69 6e 65 73 20 | 77 69 74 68 20 61 20 6c |achines |with a l|
|000015c0| 61 72 67 65 72 20 6e 61 | 74 75 72 61 6c 20 77 6f |arger na|tural wo|
|000015d0| 72 64 0d 73 69 7a 65 2c | 20 62 75 74 20 6e 6f 74 |rd.size,| but not|
|000015e0| 20 73 6d 61 6c 6c 65 72 | 2e 29 0d 57 68 65 6e 20 | smaller|.).When |
|000015f0| 74 68 65 20 72 65 73 75 | 6c 74 20 6f 66 20 61 6e |the resu|lt of an|
|00001600| 20 6f 70 65 72 61 74 69 | 6f 6e 20 66 61 6c 6c 73 | operati|on falls|
|00001610| 20 6f 75 74 73 69 64 65 | 20 74 68 69 73 20 72 61 | outside| this ra|
|00001620| 6e 67 65 2c 20 74 68 65 | 0d 65 78 63 65 70 74 69 |nge, the|.excepti|
|00001630| 6f 6e 20 5c 76 65 72 62 | 40 4f 76 65 72 66 6c 6f |on \verb|@Overflo|
|00001640| 77 45 72 72 6f 72 40 20 | 69 73 20 72 61 69 73 65 |wError@ |is raise|
|00001650| 64 2e 0d 46 6f 72 20 74 | 68 65 20 70 75 72 70 6f |d..For t|he purpo|
|00001660| 73 65 20 6f 66 20 73 68 | 69 66 74 20 61 6e 64 20 |se of sh|ift and |
|00001670| 6d 61 73 6b 20 6f 70 65 | 72 61 74 69 6f 6e 73 2c |mask ope|rations,|
|00001680| 20 69 6e 74 65 67 65 72 | 73 20 61 72 65 20 61 73 | integer|s are as|
|00001690| 73 75 6d 65 64 20 74 6f | 0d 68 61 76 65 20 61 20 |sumed to|.have a |
|000016a0| 62 69 6e 61 72 79 2c 20 | 32 27 73 20 63 6f 6d 70 |binary, |2's comp|
|000016b0| 6c 65 6d 65 6e 74 20 6e | 6f 74 61 74 69 6f 6e 20 |lement n|otation |
|000016c0| 75 73 69 6e 67 20 33 32 | 20 6f 72 20 6d 6f 72 65 |using 32| or more|
|000016d0| 20 62 69 74 73 2c 20 61 | 6e 64 0d 68 69 64 69 6e | bits, a|nd.hidin|
|000016e0| 67 20 6e 6f 20 62 69 74 | 73 20 66 72 6f 6d 20 74 |g no bit|s from t|
|000016f0| 68 65 20 75 73 65 72 20 | 28 69 2e 65 2e 2c 20 61 |he user |(i.e., a|
|00001700| 6c 6c 20 24 32 5e 7b 33 | 32 7d 24 20 64 69 66 66 |ll $2^{3|2}$ diff|
|00001710| 65 72 65 6e 74 20 62 69 | 74 0d 70 61 74 74 65 72 |erent bi|t.patter|
|00001720| 6e 73 20 63 6f 72 72 65 | 73 70 6f 6e 64 20 74 6f |ns corre|spond to|
|00001730| 20 64 69 66 66 65 72 65 | 6e 74 20 76 61 6c 75 65 | differe|nt value|
|00001740| 73 29 2e 0d 5c 6f 62 69 | 6e 64 65 78 7b 70 6c 61 |s)..\obi|ndex{pla|
|00001750| 69 6e 20 69 6e 74 65 67 | 65 72 7d 0d 0d 5c 69 74 |in integ|er}..\it|
|00001760| 65 6d 5b 4c 6f 6e 67 20 | 69 6e 74 65 67 65 72 73 |em[Long |integers|
|00001770| 5d 0d 54 68 65 73 65 20 | 72 65 70 72 65 73 65 6e |].These |represen|
|00001780| 74 20 6e 75 6d 62 65 72 | 73 20 69 6e 20 61 6e 20 |t number|s in an |
|00001790| 75 6e 6c 69 6d 69 74 65 | 64 20 72 61 6e 67 65 2c |unlimite|d range,|
|000017a0| 20 73 75 62 6a 65 63 74 | 20 74 6f 20 61 76 61 69 | subject| to avai|
|000017b0| 6c 61 62 6c 65 0d 28 76 | 69 72 74 75 61 6c 29 20 |lable.(v|irtual) |
|000017c0| 6d 65 6d 6f 72 79 20 6f | 6e 6c 79 2e 20 20 46 6f |memory o|nly. Fo|
|000017d0| 72 20 74 68 65 20 70 75 | 72 70 6f 73 65 20 6f 66 |r the pu|rpose of|
|000017e0| 20 73 68 69 66 74 20 61 | 6e 64 20 6d 61 73 6b 20 | shift a|nd mask |
|000017f0| 6f 70 65 72 61 74 69 6f | 6e 73 2c 0d 61 20 62 69 |operatio|ns,.a bi|
|00001800| 6e 61 72 79 20 72 65 70 | 72 65 73 65 6e 74 61 74 |nary rep|resentat|
|00001810| 69 6f 6e 20 69 73 20 61 | 73 73 75 6d 65 64 2c 20 |ion is a|ssumed, |
|00001820| 61 6e 64 20 6e 65 67 61 | 74 69 76 65 20 6e 75 6d |and nega|tive num|
|00001830| 62 65 72 73 20 61 72 65 | 0d 72 65 70 72 65 73 65 |bers are|.represe|
|00001840| 6e 74 65 64 20 69 6e 20 | 61 20 76 61 72 69 61 6e |nted in |a varian|
|00001850| 74 20 6f 66 20 32 27 73 | 20 63 6f 6d 70 6c 65 6d |t of 2's| complem|
|00001860| 65 6e 74 20 77 68 69 63 | 68 20 67 69 76 65 73 20 |ent whic|h gives |
|00001870| 74 68 65 20 69 6c 6c 75 | 73 69 6f 6e 20 6f 66 0d |the illu|sion of.|
|00001880| 61 6e 20 69 6e 66 69 6e | 69 74 65 20 73 74 72 69 |an infin|ite stri|
|00001890| 6e 67 20 6f 66 20 73 69 | 67 6e 20 62 69 74 73 20 |ng of si|gn bits |
|000018a0| 65 78 74 65 6e 64 69 6e | 67 20 74 6f 20 74 68 65 |extendin|g to the|
|000018b0| 20 6c 65 66 74 2e 0d 5c | 6f 62 69 6e 64 65 78 7b | left..\|obindex{|
|000018c0| 6c 6f 6e 67 20 69 6e 74 | 65 67 65 72 7d 0d 0d 5c |long int|eger}..\|
|000018d0| 65 6e 64 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |end{desc|ription}|
|000018e0| 20 25 20 49 6e 74 65 67 | 65 72 73 0d 0d 54 68 65 | % Integ|ers..The|
|000018f0| 20 72 75 6c 65 73 20 66 | 6f 72 20 69 6e 74 65 67 | rules f|or integ|
|00001900| 65 72 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |er repre|sentatio|
|00001910| 6e 20 61 72 65 20 69 6e | 74 65 6e 64 65 64 20 74 |n are in|tended t|
|00001920| 6f 20 67 69 76 65 20 74 | 68 65 20 6d 6f 73 74 0d |o give t|he most.|
|00001930| 6d 65 61 6e 69 6e 67 66 | 75 6c 20 69 6e 74 65 72 |meaningf|ul inter|
|00001940| 70 72 65 74 61 74 69 6f | 6e 20 6f 66 20 73 68 69 |pretatio|n of shi|
|00001950| 66 74 20 61 6e 64 20 6d | 61 73 6b 20 6f 70 65 72 |ft and m|ask oper|
|00001960| 61 74 69 6f 6e 73 20 69 | 6e 76 6f 6c 76 69 6e 67 |ations i|nvolving|
|00001970| 0d 6e 65 67 61 74 69 76 | 65 20 69 6e 74 65 67 65 |.negativ|e intege|
|00001980| 72 73 20 61 6e 64 20 74 | 68 65 20 6c 65 61 73 74 |rs and t|he least|
|00001990| 20 73 75 72 70 72 69 73 | 65 73 20 77 68 65 6e 20 | surpris|es when |
|000019a0| 73 77 69 74 63 68 69 6e | 67 20 62 65 74 77 65 65 |switchin|g betwee|
|000019b0| 6e 20 74 68 65 0d 70 6c | 61 69 6e 20 61 6e 64 20 |n the.pl|ain and |
|000019c0| 6c 6f 6e 67 20 69 6e 74 | 65 67 65 72 20 64 6f 6d |long int|eger dom|
|000019d0| 61 69 6e 73 2e 20 20 46 | 6f 72 20 61 6e 79 20 6f |ains. F|or any o|
|000019e0| 70 65 72 61 74 69 6f 6e | 20 65 78 63 65 70 74 20 |peration| except |
|000019f0| 6c 65 66 74 20 73 68 69 | 66 74 2c 0d 69 66 20 69 |left shi|ft,.if i|
|00001a00| 74 20 79 69 65 6c 64 73 | 20 61 20 72 65 73 75 6c |t yields| a resul|
|00001a10| 74 20 69 6e 20 74 68 65 | 20 70 6c 61 69 6e 20 69 |t in the| plain i|
|00001a20| 6e 74 65 67 65 72 20 64 | 6f 6d 61 69 6e 20 77 69 |nteger d|omain wi|
|00001a30| 74 68 6f 75 74 20 63 61 | 75 73 69 6e 67 0d 6f 76 |thout ca|using.ov|
|00001a40| 65 72 66 6c 6f 77 2c 20 | 69 74 20 77 69 6c 6c 20 |erflow, |it will |
|00001a50| 79 69 65 6c 64 20 74 68 | 65 20 73 61 6d 65 20 72 |yield th|e same r|
|00001a60| 65 73 75 6c 74 20 69 6e | 20 74 68 65 20 6c 6f 6e |esult in| the lon|
|00001a70| 67 20 69 6e 74 65 67 65 | 72 20 64 6f 6d 61 69 6e |g intege|r domain|
|00001a80| 20 6f 72 0d 77 68 65 6e | 20 75 73 69 6e 67 20 6d | or.when| using m|
|00001a90| 69 78 65 64 20 6f 70 65 | 72 61 6e 64 73 2e 0d 5c |ixed ope|rands..\|
|00001aa0| 69 6e 64 65 78 69 69 7b | 69 6e 74 65 67 65 72 7d |indexii{|integer}|
|00001ab0| 7b 72 65 70 72 65 73 65 | 6e 74 61 74 69 6f 6e 7d |{represe|ntation}|
|00001ac0| 0d 0d 5c 69 74 65 6d 5b | 46 6c 6f 61 74 69 6e 67 |..\item[|Floating|
|00001ad0| 20 70 6f 69 6e 74 20 6e | 75 6d 62 65 72 73 5d 0d | point n|umbers].|
|00001ae0| 54 68 65 73 65 20 72 65 | 70 72 65 73 65 6e 74 20 |These re|present |
|00001af0| 6d 61 63 68 69 6e 65 2d | 6c 65 76 65 6c 20 64 6f |machine-|level do|
|00001b00| 75 62 6c 65 20 70 72 65 | 63 69 73 69 6f 6e 20 66 |uble pre|cision f|
|00001b10| 6c 6f 61 74 69 6e 67 20 | 70 6f 69 6e 74 20 6e 75 |loating |point nu|
|00001b20| 6d 62 65 72 73 2e 20 20 | 0d 59 6f 75 20 61 72 65 |mbers. |.You are|
|00001b30| 20 61 74 20 74 68 65 20 | 6d 65 72 63 79 20 6f 66 | at the |mercy of|
|00001b40| 20 74 68 65 20 75 6e 64 | 65 72 6c 79 69 6e 67 20 | the und|erlying |
|00001b50| 6d 61 63 68 69 6e 65 20 | 61 72 63 68 69 74 65 63 |machine |architec|
|00001b60| 74 75 72 65 20 61 6e 64 | 0d 43 20 69 6d 70 6c 65 |ture and|.C imple|
|00001b70| 6d 65 6e 74 61 74 69 6f | 6e 20 66 6f 72 20 74 68 |mentatio|n for th|
|00001b80| 65 20 61 63 63 65 70 74 | 65 64 20 72 61 6e 67 65 |e accept|ed range|
|00001b90| 20 61 6e 64 20 68 61 6e | 64 6c 69 6e 67 20 6f 66 | and han|dling of|
|00001ba0| 20 6f 76 65 72 66 6c 6f | 77 2e 0d 5c 6f 62 69 6e | overflo|w..\obin|
|00001bb0| 64 65 78 7b 66 6c 6f 61 | 74 69 6e 67 20 70 6f 69 |dex{floa|ting poi|
|00001bc0| 6e 74 7d 0d 5c 69 6e 64 | 65 78 69 69 7b 66 6c 6f |nt}.\ind|exii{flo|
|00001bd0| 61 74 69 6e 67 20 70 6f | 69 6e 74 7d 7b 6e 75 6d |ating po|int}{num|
|00001be0| 62 65 72 7d 0d 5c 69 6e | 64 65 78 7b 43 7d 0d 0d |ber}.\in|dex{C}..|
|00001bf0| 5c 65 6e 64 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |\end{des|cription|
|00001c00| 7d 20 25 20 4e 75 6d 62 | 65 72 73 0d 0d 5c 69 74 |} % Numb|ers..\it|
|00001c10| 65 6d 5b 53 65 71 75 65 | 6e 63 65 73 5d 0d 54 68 |em[Seque|nces].Th|
|00001c20| 65 73 65 20 72 65 70 72 | 65 73 65 6e 74 20 66 69 |ese repr|esent fi|
|00001c30| 6e 69 74 65 20 6f 72 64 | 65 72 65 64 20 73 65 74 |nite ord|ered set|
|00001c40| 73 20 69 6e 64 65 78 65 | 64 20 62 79 20 6e 61 74 |s indexe|d by nat|
|00001c50| 75 72 61 6c 20 6e 75 6d | 62 65 72 73 2e 0d 54 68 |ural num|bers..Th|
|00001c60| 65 20 62 75 69 6c 74 2d | 69 6e 20 66 75 6e 63 74 |e built-|in funct|
|00001c70| 69 6f 6e 20 5c 76 65 72 | 62 40 6c 65 6e 28 29 40 |ion \ver|b@len()@|
|00001c80| 20 72 65 74 75 72 6e 73 | 20 74 68 65 20 6e 75 6d | returns| the num|
|00001c90| 62 65 72 20 6f 66 20 65 | 6c 65 6d 65 6e 74 73 0d |ber of e|lements.|
|00001ca0| 6f 66 20 61 20 73 65 71 | 75 65 6e 63 65 2e 20 20 |of a seq|uence. |
|00001cb0| 57 68 65 6e 20 74 68 69 | 73 20 6e 75 6d 62 65 72 |When thi|s number|
|00001cc0| 20 69 73 20 24 6e 24 2c | 20 74 68 65 20 69 6e 64 | is $n$,| the ind|
|00001cd0| 65 78 20 73 65 74 20 63 | 6f 6e 74 61 69 6e 73 0d |ex set c|ontains.|
|00001ce0| 74 68 65 20 6e 75 6d 62 | 65 72 73 20 24 30 2c 20 |the numb|ers $0, |
|00001cf0| 31 2c 20 5c 6c 64 6f 74 | 73 2c 20 6e 2d 31 24 2e |1, \ldot|s, n-1$.|
|00001d00| 20 20 45 6c 65 6d 65 6e | 74 20 5c 76 65 72 62 40 | Elemen|t \verb@|
|00001d10| 69 40 20 6f 66 20 73 65 | 71 75 65 6e 63 65 0d 5c |i@ of se|quence.\|
|00001d20| 76 65 72 62 40 61 40 20 | 69 73 20 73 65 6c 65 63 |verb@a@ |is selec|
|00001d30| 74 65 64 20 62 79 20 5c | 76 65 72 62 40 61 5b 69 |ted by \|verb@a[i|
|00001d40| 5d 40 2e 0d 5c 6f 62 69 | 6e 64 65 78 7b 73 65 71 |]@..\obi|ndex{seq|
|00001d50| 65 6e 63 65 7d 0d 5c 62 | 69 66 75 6e 63 69 6e 64 |ence}.\b|ifuncind|
|00001d60| 65 78 7b 6c 65 6e 7d 0d | 5c 69 6e 64 65 78 7b 69 |ex{len}.|\index{i|
|00001d70| 6e 64 65 78 20 6f 70 65 | 72 61 74 69 6f 6e 7d 0d |ndex ope|ration}.|
|00001d80| 5c 69 6e 64 65 78 7b 69 | 74 65 6d 20 73 65 6c 65 |\index{i|tem sele|
|00001d90| 63 74 69 6f 6e 7d 0d 5c | 69 6e 64 65 78 7b 73 75 |ction}.\|index{su|
|00001da0| 62 73 63 72 69 70 74 69 | 6f 6e 7d 0d 0d 53 65 71 |bscripti|on}..Seq|
|00001db0| 75 65 6e 63 65 73 20 61 | 6c 73 6f 20 73 75 70 70 |uences a|lso supp|
|00001dc0| 6f 72 74 20 73 6c 69 63 | 69 6e 67 3a 20 5c 76 65 |ort slic|ing: \ve|
|00001dd0| 72 62 40 61 5b 69 3a 6a | 5d 40 20 73 65 6c 65 63 |rb@a[i:j|]@ selec|
|00001de0| 74 73 20 61 6c 6c 20 65 | 6c 65 6d 65 6e 74 73 0d |ts all e|lements.|
|00001df0| 77 69 74 68 20 69 6e 64 | 65 78 20 24 6b 24 20 73 |with ind|ex $k$ s|
|00001e00| 75 63 68 20 74 68 61 74 | 20 24 69 20 3c 3d 20 6b |uch that| $i <= k|
|00001e10| 20 3c 20 6a 24 2e 20 20 | 57 68 65 6e 20 75 73 65 | < j$. |When use|
|00001e20| 64 20 61 73 20 61 6e 20 | 65 78 70 72 65 73 73 69 |d as an |expressi|
|00001e30| 6f 6e 2c 0d 61 20 73 6c | 69 63 65 20 69 73 20 61 |on,.a sl|ice is a|
|00001e40| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 74 68 65 | sequenc|e of the|
|00001e50| 20 73 61 6d 65 20 74 79 | 70 65 20 2d 2d 2d 20 74 | same ty|pe --- t|
|00001e60| 68 69 73 20 69 6d 70 6c | 69 65 73 20 74 68 61 74 |his impl|ies that|
|00001e70| 20 74 68 65 0d 69 6e 64 | 65 78 20 73 65 74 20 69 | the.ind|ex set i|
|00001e80| 73 20 72 65 6e 75 6d 62 | 65 72 65 64 20 73 6f 20 |s renumb|ered so |
|00001e90| 74 68 61 74 20 69 74 20 | 73 74 61 72 74 73 20 61 |that it |starts a|
|00001ea0| 74 20 30 20 61 67 61 69 | 6e 2e 0d 5c 69 6e 64 65 |t 0 agai|n..\inde|
|00001eb0| 78 7b 73 6c 69 63 69 6e | 67 7d 0d 0d 53 65 71 75 |x{slicin|g}..Sequ|
|00001ec0| 65 6e 63 65 73 20 61 72 | 65 20 64 69 73 74 69 6e |ences ar|e distin|
|00001ed0| 67 75 69 73 68 65 64 20 | 61 63 63 6f 72 64 69 6e |guished |accordin|
|00001ee0| 67 20 74 6f 20 74 68 65 | 69 72 20 6d 75 74 61 62 |g to the|ir mutab|
|00001ef0| 69 6c 69 74 79 3a 0d 0d | 5c 62 65 67 69 6e 7b 64 |ility:..|\begin{d|
|00001f00| 65 73 63 72 69 70 74 69 | 6f 6e 7d 0d 25 0d 5c 69 |escripti|on}.%.\i|
|00001f10| 74 65 6d 5b 49 6d 6d 75 | 74 61 62 6c 65 20 73 65 |tem[Immu|table se|
|00001f20| 71 75 65 6e 63 65 73 5d | 0d 41 6e 20 6f 62 6a 65 |quences]|.An obje|
|00001f30| 63 74 20 6f 66 20 61 6e | 20 69 6d 6d 75 74 61 62 |ct of an| immutab|
|00001f40| 6c 65 20 73 65 71 75 65 | 6e 63 65 20 74 79 70 65 |le seque|nce type|
|00001f50| 20 63 61 6e 6e 6f 74 20 | 63 68 61 6e 67 65 20 6f | cannot |change o|
|00001f60| 6e 63 65 20 69 74 20 69 | 73 0d 63 72 65 61 74 65 |nce it i|s.create|
|00001f70| 64 2e 20 20 28 49 66 20 | 74 68 65 20 6f 62 6a 65 |d. (If |the obje|
|00001f80| 63 74 20 63 6f 6e 74 61 | 69 6e 73 20 72 65 66 65 |ct conta|ins refe|
|00001f90| 72 65 6e 63 65 73 20 74 | 6f 20 6f 74 68 65 72 20 |rences t|o other |
|00001fa0| 6f 62 6a 65 63 74 73 2c | 0d 74 68 65 73 65 20 6f |objects,|.these o|
|00001fb0| 74 68 65 72 20 6f 62 6a | 65 63 74 73 20 6d 61 79 |ther obj|ects may|
|00001fc0| 20 62 65 20 6d 75 74 61 | 62 6c 65 20 61 6e 64 20 | be muta|ble and |
|00001fd0| 6d 61 79 20 62 65 20 63 | 68 61 6e 67 65 64 3b 20 |may be c|hanged; |
|00001fe0| 68 6f 77 65 76 65 72 0d | 74 68 65 20 63 6f 6c 6c |however.|the coll|
|00001ff0| 65 63 74 69 6f 6e 20 6f | 66 20 6f 62 6a 65 63 74 |ection o|f object|
|00002000| 73 20 64 69 72 65 63 74 | 6c 79 20 72 65 66 65 72 |s direct|ly refer|
|00002010| 65 6e 63 65 64 20 62 79 | 20 61 6e 20 69 6d 6d 75 |enced by| an immu|
|00002020| 74 61 62 6c 65 20 6f 62 | 6a 65 63 74 0d 63 61 6e |table ob|ject.can|
|00002030| 6e 6f 74 20 63 68 61 6e | 67 65 2e 29 0d 5c 6f 62 |not chan|ge.).\ob|
|00002040| 69 6e 64 65 78 7b 69 6d | 6d 75 74 61 62 6c 65 20 |index{im|mutable |
|00002050| 73 65 71 75 65 6e 63 65 | 7d 0d 5c 6f 62 69 6e 64 |sequence|}.\obind|
|00002060| 65 78 7b 69 6d 6d 75 74 | 61 62 6c 65 7d 0d 0d 54 |ex{immut|able}..T|
|00002070| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 74 79 70 |he follo|wing typ|
|00002080| 65 73 20 61 72 65 20 69 | 6d 6d 75 74 61 62 6c 65 |es are i|mmutable|
|00002090| 20 73 65 71 75 65 6e 63 | 65 73 3a 0d 0d 5c 62 65 | sequenc|es:..\be|
|000020a0| 67 69 6e 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |gin{desc|ription}|
|000020b0| 0d 0d 5c 69 74 65 6d 5b | 53 74 72 69 6e 67 73 5d |..\item[|Strings]|
|000020c0| 0d 54 68 65 20 65 6c 65 | 6d 65 6e 74 73 20 6f 66 |.The ele|ments of|
|000020d0| 20 61 20 73 74 72 69 6e | 67 20 61 72 65 20 63 68 | a strin|g are ch|
|000020e0| 61 72 61 63 74 65 72 73 | 2e 20 20 54 68 65 72 65 |aracters|. There|
|000020f0| 20 69 73 20 6e 6f 20 73 | 65 70 61 72 61 74 65 0d | is no s|eparate.|
|00002100| 63 68 61 72 61 63 74 65 | 72 20 74 79 70 65 3b 20 |characte|r type; |
|00002110| 61 20 63 68 61 72 61 63 | 74 65 72 20 69 73 20 72 |a charac|ter is r|
|00002120| 65 70 72 65 73 65 6e 74 | 65 64 20 62 79 20 61 20 |epresent|ed by a |
|00002130| 73 74 72 69 6e 67 20 6f | 66 20 6f 6e 65 20 65 6c |string o|f one el|
|00002140| 65 6d 65 6e 74 2e 0d 43 | 68 61 72 61 63 74 65 72 |ement..C|haracter|
|00002150| 73 20 72 65 70 72 65 73 | 65 6e 74 20 28 61 74 20 |s repres|ent (at |
|00002160| 6c 65 61 73 74 29 20 38 | 2d 62 69 74 20 62 79 74 |least) 8|-bit byt|
|00002170| 65 73 2e 20 20 54 68 65 | 20 62 75 69 6c 74 2d 69 |es. The| built-i|
|00002180| 6e 0d 66 75 6e 63 74 69 | 6f 6e 73 20 5c 76 65 72 |n.functi|ons \ver|
|00002190| 62 40 63 68 72 28 29 40 | 20 61 6e 64 20 5c 76 65 |b@chr()@| and \ve|
|000021a0| 72 62 40 6f 72 64 28 29 | 40 20 63 6f 6e 76 65 72 |rb@ord()|@ conver|
|000021b0| 74 20 62 65 74 77 65 65 | 6e 20 63 68 61 72 61 63 |t betwee|n charac|
|000021c0| 74 65 72 73 0d 61 6e 64 | 20 6e 6f 6e 6e 65 67 61 |ters.and| nonnega|
|000021d0| 74 69 76 65 20 69 6e 74 | 65 67 65 72 73 20 72 65 |tive int|egers re|
|000021e0| 70 72 65 73 65 6e 74 69 | 6e 67 20 74 68 65 20 62 |presenti|ng the b|
|000021f0| 79 74 65 20 76 61 6c 75 | 65 73 2e 0d 42 79 74 65 |yte valu|es..Byte|
|00002200| 73 20 77 69 74 68 20 74 | 68 65 20 76 61 6c 75 65 |s with t|he value|
|00002210| 73 20 30 2d 31 32 37 20 | 72 65 70 72 65 73 65 6e |s 0-127 |represen|
|00002220| 74 20 74 68 65 20 63 6f | 72 72 65 73 70 6f 6e 64 |t the co|rrespond|
|00002230| 69 6e 67 20 41 53 43 49 | 49 20 76 61 6c 75 65 73 |ing ASCI|I values|
|00002240| 2e 0d 54 68 65 20 73 74 | 72 69 6e 67 20 64 61 74 |..The st|ring dat|
|00002250| 61 20 74 79 70 65 20 69 | 73 20 61 6c 73 6f 20 75 |a type i|s also u|
|00002260| 73 65 64 20 74 6f 20 72 | 65 70 72 65 73 65 6e 74 |sed to r|epresent|
|00002270| 20 61 72 72 61 79 73 20 | 6f 66 20 62 79 74 65 73 | arrays |of bytes|
|00002280| 2c 20 65 2e 67 2e 0d 74 | 6f 20 68 6f 6c 64 20 64 |, e.g..t|o hold d|
|00002290| 61 74 61 20 72 65 61 64 | 20 66 72 6f 6d 20 61 20 |ata read| from a |
|000022a0| 66 69 6c 65 2e 0d 5c 6f | 62 69 6e 64 65 78 7b 73 |file..\o|bindex{s|
|000022b0| 74 72 69 6e 67 7d 0d 5c | 69 6e 64 65 78 7b 63 68 |tring}.\|index{ch|
|000022c0| 61 72 61 63 74 65 72 7d | 0d 5c 69 6e 64 65 78 7b |aracter}|.\index{|
|000022d0| 62 79 74 65 7d 0d 5c 69 | 6e 64 65 78 7b 41 53 43 |byte}.\i|ndex{ASC|
|000022e0| 49 49 7d 0d 5c 62 69 66 | 75 6e 63 69 6e 64 65 78 |II}.\bif|uncindex|
|000022f0| 7b 63 68 72 7d 0d 5c 62 | 69 66 75 6e 63 69 6e 64 |{chr}.\b|ifuncind|
|00002300| 65 78 7b 6f 72 64 7d 0d | 0d 28 4f 6e 20 73 79 73 |ex{ord}.|.(On sys|
|00002310| 74 65 6d 73 20 77 68 6f | 73 65 20 6e 61 74 69 76 |tems who|se nativ|
|00002320| 65 20 63 68 61 72 61 63 | 74 65 72 20 73 65 74 20 |e charac|ter set |
|00002330| 69 73 20 6e 6f 74 20 41 | 53 43 49 49 2c 20 73 74 |is not A|SCII, st|
|00002340| 72 69 6e 67 73 20 6d 61 | 79 20 75 73 65 0d 45 42 |rings ma|y use.EB|
|00002350| 43 44 49 43 20 69 6e 20 | 74 68 65 69 72 20 69 6e |CDIC in |their in|
|00002360| 74 65 72 6e 61 6c 20 72 | 65 70 72 65 73 65 6e 74 |ternal r|epresent|
|00002370| 61 74 69 6f 6e 2c 20 70 | 72 6f 76 69 64 65 64 20 |ation, p|rovided |
|00002380| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 73 0d 5c 76 |the func|tions.\v|
|00002390| 65 72 62 40 63 68 72 28 | 29 40 20 61 6e 64 20 5c |erb@chr(|)@ and \|
|000023a0| 76 65 72 62 40 6f 72 64 | 28 29 40 20 69 6d 70 6c |verb@ord|()@ impl|
|000023b0| 65 6d 65 6e 74 20 61 20 | 6d 61 70 70 69 6e 67 20 |ement a |mapping |
|000023c0| 62 65 74 77 65 65 6e 20 | 41 53 43 49 49 20 61 6e |between |ASCII an|
|000023d0| 64 0d 45 42 43 44 49 43 | 2c 20 61 6e 64 20 73 74 |d.EBCDIC|, and st|
|000023e0| 72 69 6e 67 20 63 6f 6d | 70 61 72 69 73 6f 6e 20 |ring com|parison |
|000023f0| 70 72 65 73 65 72 76 65 | 73 20 74 68 65 20 41 53 |preserve|s the AS|
|00002400| 43 49 49 20 6f 72 64 65 | 72 2e 0d 4f 72 20 70 65 |CII orde|r..Or pe|
|00002410| 72 68 61 70 73 20 73 6f | 6d 65 6f 6e 65 20 63 61 |rhaps so|meone ca|
|00002420| 6e 20 70 72 6f 70 6f 73 | 65 20 61 20 62 65 74 74 |n propos|e a bett|
|00002430| 65 72 20 72 75 6c 65 3f | 29 0d 5c 69 6e 64 65 78 |er rule?|).\index|
|00002440| 7b 41 53 43 49 49 7d 0d | 5c 69 6e 64 65 78 7b 45 |{ASCII}.|\index{E|
|00002450| 42 43 44 49 43 7d 0d 5c | 69 6e 64 65 78 7b 63 68 |BCDIC}.\|index{ch|
|00002460| 61 72 61 63 74 65 72 20 | 73 65 74 7d 0d 5c 69 6e |aracter |set}.\in|
|00002470| 64 65 78 69 69 7b 73 74 | 72 69 6e 67 7d 7b 63 6f |dexii{st|ring}{co|
|00002480| 6d 70 61 72 69 73 6f 6e | 7d 0d 5c 62 69 66 75 6e |mparison|}.\bifun|
|00002490| 63 69 6e 64 65 78 7b 63 | 68 72 7d 0d 5c 62 69 66 |cindex{c|hr}.\bif|
|000024a0| 75 6e 63 69 6e 64 65 78 | 7b 6f 72 64 7d 0d 0d 5c |uncindex|{ord}..\|
|000024b0| 69 74 65 6d 5b 54 75 70 | 6c 65 73 5d 0d 54 68 65 |item[Tup|les].The|
|000024c0| 20 65 6c 65 6d 65 6e 74 | 73 20 6f 66 20 61 20 74 | element|s of a t|
|000024d0| 75 70 6c 65 20 61 72 65 | 20 61 72 62 69 74 72 61 |uple are| arbitra|
|000024e0| 72 79 20 50 79 74 68 6f | 6e 20 6f 62 6a 65 63 74 |ry Pytho|n object|
|000024f0| 73 2e 0d 54 75 70 6c 65 | 73 20 6f 66 20 74 77 6f |s..Tuple|s of two|
|00002500| 20 6f 72 20 6d 6f 72 65 | 20 65 6c 65 6d 65 6e 74 | or more| element|
|00002510| 73 20 61 72 65 20 66 6f | 72 6d 65 64 20 62 79 20 |s are fo|rmed by |
|00002520| 63 6f 6d 6d 61 2d 73 65 | 70 61 72 61 74 65 64 20 |comma-se|parated |
|00002530| 6c 69 73 74 73 0d 6f 66 | 20 65 78 70 72 65 73 73 |lists.of| express|
|00002540| 69 6f 6e 73 2e 20 20 41 | 20 74 75 70 6c 65 20 6f |ions. A| tuple o|
|00002550| 66 20 6f 6e 65 20 65 6c | 65 6d 65 6e 74 20 28 61 |f one el|ement (a|
|00002560| 20 60 73 69 6e 67 6c 65 | 74 6f 6e 27 29 20 63 61 | `single|ton') ca|
|00002570| 6e 20 62 65 20 66 6f 72 | 6d 65 64 0d 62 79 20 61 |n be for|med.by a|
|00002580| 66 66 69 78 69 6e 67 20 | 61 20 63 6f 6d 6d 61 20 |ffixing |a comma |
|00002590| 74 6f 20 61 6e 20 65 78 | 70 72 65 73 73 69 6f 6e |to an ex|pression|
|000025a0| 20 28 61 6e 20 65 78 70 | 72 65 73 73 69 6f 6e 20 | (an exp|ression |
|000025b0| 62 79 20 69 74 73 65 6c | 66 20 64 6f 65 73 0d 6e |by itsel|f does.n|
|000025c0| 6f 74 20 63 72 65 61 74 | 65 20 61 20 74 75 70 6c |ot creat|e a tupl|
|000025d0| 65 2c 20 73 69 6e 63 65 | 20 70 61 72 65 6e 74 68 |e, since| parenth|
|000025e0| 65 73 65 73 20 6d 75 73 | 74 20 62 65 20 75 73 61 |eses mus|t be usa|
|000025f0| 62 6c 65 20 66 6f 72 20 | 67 72 6f 75 70 69 6e 67 |ble for |grouping|
|00002600| 20 6f 66 0d 65 78 70 72 | 65 73 73 69 6f 6e 73 29 | of.expr|essions)|
|00002610| 2e 20 20 41 6e 20 65 6d | 70 74 79 20 74 75 70 6c |. An em|pty tupl|
|00002620| 65 20 63 61 6e 20 62 65 | 20 66 6f 72 6d 65 64 20 |e can be| formed |
|00002630| 62 79 20 65 6e 63 6c 6f | 73 69 6e 67 20 60 6e 6f |by enclo|sing `no|
|00002640| 74 68 69 6e 67 27 20 69 | 6e 0d 70 61 72 65 6e 74 |thing' i|n.parent|
|00002650| 68 65 73 65 73 2e 0d 5c | 6f 62 69 6e 64 65 78 7b |heses..\|obindex{|
|00002660| 74 75 70 6c 65 7d 0d 5c | 69 6e 64 65 78 69 69 7b |tuple}.\|indexii{|
|00002670| 73 69 6e 67 6c 65 74 6f | 6e 7d 7b 74 75 70 6c 65 |singleto|n}{tuple|
|00002680| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 65 6d 70 74 79 |}.\index|ii{empty|
|00002690| 7d 7b 74 75 70 6c 65 7d | 0d 0d 5c 65 6e 64 7b 64 |}{tuple}|..\end{d|
|000026a0| 65 73 63 72 69 70 74 69 | 6f 6e 7d 20 25 20 49 6d |escripti|on} % Im|
|000026b0| 6d 75 74 61 62 6c 65 20 | 73 65 71 75 65 6e 63 65 |mutable |sequence|
|000026c0| 73 0d 0d 5c 69 74 65 6d | 5b 4d 75 74 61 62 6c 65 |s..\item|[Mutable|
|000026d0| 20 73 65 71 75 65 6e 63 | 65 73 5d 0d 4d 75 74 61 | sequenc|es].Muta|
|000026e0| 62 6c 65 20 73 65 71 75 | 65 6e 63 65 73 20 63 61 |ble sequ|ences ca|
|000026f0| 6e 20 62 65 20 63 68 61 | 6e 67 65 64 20 61 66 74 |n be cha|nged aft|
|00002700| 65 72 20 74 68 65 79 20 | 61 72 65 20 63 72 65 61 |er they |are crea|
|00002710| 74 65 64 2e 20 20 54 68 | 65 0d 73 75 62 73 63 72 |ted. Th|e.subscr|
|00002720| 69 70 74 69 6f 6e 20 61 | 6e 64 20 73 6c 69 63 69 |iption a|nd slici|
|00002730| 6e 67 20 6e 6f 74 61 74 | 69 6f 6e 73 20 63 61 6e |ng notat|ions can|
|00002740| 20 62 65 20 75 73 65 64 | 20 61 73 20 74 68 65 20 | be used| as the |
|00002750| 74 61 72 67 65 74 20 6f | 66 0d 61 73 73 69 67 6e |target o|f.assign|
|00002760| 6d 65 6e 74 20 61 6e 64 | 20 5c 76 65 72 62 40 64 |ment and| \verb@d|
|00002770| 65 6c 40 20 28 64 65 6c | 65 74 65 29 20 73 74 61 |el@ (del|ete) sta|
|00002780| 74 65 6d 65 6e 74 73 2e | 0d 5c 6f 62 69 6e 64 65 |tements.|.\obinde|
|00002790| 78 7b 6d 75 74 61 62 6c | 65 20 73 65 71 75 65 63 |x{mutabl|e sequec|
|000027a0| 65 7d 0d 5c 6f 62 69 6e | 64 65 78 7b 6d 75 74 61 |e}.\obin|dex{muta|
|000027b0| 62 6c 65 7d 0d 5c 69 6e | 64 65 78 69 69 7b 61 73 |ble}.\in|dexii{as|
|000027c0| 73 69 67 6e 6d 65 6e 74 | 7d 7b 73 74 61 74 65 6d |signment|}{statem|
|000027d0| 65 6e 74 7d 0d 5c 69 6e | 64 65 78 7b 64 65 6c 65 |ent}.\in|dex{dele|
|000027e0| 74 65 7d 0d 5c 73 74 69 | 6e 64 65 78 7b 64 65 6c |te}.\sti|ndex{del|
|000027f0| 7d 0d 5c 69 6e 64 65 78 | 7b 73 75 62 73 63 72 69 |}.\index|{subscri|
|00002800| 70 74 69 6f 6e 7d 0d 5c | 69 6e 64 65 78 7b 73 6c |ption}.\|index{sl|
|00002810| 69 63 69 6e 67 7d 0d 0d | 54 68 65 72 65 20 69 73 |icing}..|There is|
|00002820| 20 63 75 72 72 65 6e 74 | 6c 79 20 61 20 73 69 6e | current|ly a sin|
|00002830| 67 6c 65 20 6d 75 74 61 | 62 6c 65 20 73 65 71 75 |gle muta|ble sequ|
|00002840| 65 6e 63 65 20 74 79 70 | 65 3a 0d 0d 5c 62 65 67 |ence typ|e:..\beg|
|00002850| 69 6e 7b 64 65 73 63 72 | 69 70 74 69 6f 6e 7d 0d |in{descr|iption}.|
|00002860| 0d 5c 69 74 65 6d 5b 4c | 69 73 74 73 5d 0d 54 68 |.\item[L|ists].Th|
|00002870| 65 20 65 6c 65 6d 65 6e | 74 73 20 6f 66 20 61 20 |e elemen|ts of a |
|00002880| 6c 69 73 74 20 61 72 65 | 20 61 72 62 69 74 72 61 |list are| arbitra|
|00002890| 72 79 20 50 79 74 68 6f | 6e 20 6f 62 6a 65 63 74 |ry Pytho|n object|
|000028a0| 73 2e 20 20 4c 69 73 74 | 73 20 61 72 65 20 66 6f |s. List|s are fo|
|000028b0| 72 6d 65 64 0d 62 79 20 | 70 6c 61 63 69 6e 67 20 |rmed.by |placing |
|000028c0| 61 20 63 6f 6d 6d 61 2d | 73 65 70 61 72 61 74 65 |a comma-|separate|
|000028d0| 64 20 6c 69 73 74 20 6f | 66 20 65 78 70 72 65 73 |d list o|f expres|
|000028e0| 73 69 6f 6e 73 20 69 6e | 20 73 71 75 61 72 65 20 |sions in| square |
|000028f0| 62 72 61 63 6b 65 74 73 | 2e 0d 28 4e 6f 74 65 20 |brackets|..(Note |
|00002900| 74 68 61 74 20 74 68 65 | 72 65 20 61 72 65 20 6e |that the|re are n|
|00002910| 6f 20 73 70 65 63 69 61 | 6c 20 63 61 73 65 73 20 |o specia|l cases |
|00002920| 6e 65 65 64 65 64 20 74 | 6f 20 66 6f 72 6d 20 6c |needed t|o form l|
|00002930| 69 73 74 73 20 6f 66 20 | 6c 65 6e 67 74 68 20 30 |ists of |length 0|
|00002940| 0d 6f 72 20 31 2e 29 0d | 5c 6f 62 69 6e 64 65 78 |.or 1.).|\obindex|
|00002950| 7b 6c 69 73 74 7d 0d 0d | 5c 65 6e 64 7b 64 65 73 |{list}..|\end{des|
|00002960| 63 72 69 70 74 69 6f 6e | 7d 20 25 20 4d 75 74 61 |cription|} % Muta|
|00002970| 62 6c 65 20 73 65 71 75 | 65 6e 63 65 73 0d 0d 5c |ble sequ|ences..\|
|00002980| 65 6e 64 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |end{desc|ription}|
|00002990| 20 25 20 53 65 71 75 65 | 6e 63 65 73 0d 0d 5c 69 | % Seque|nces..\i|
|000029a0| 74 65 6d 5b 4d 61 70 70 | 69 6e 67 20 74 79 70 65 |tem[Mapp|ing type|
|000029b0| 73 5d 0d 54 68 65 73 65 | 20 72 65 70 72 65 73 65 |s].These| represe|
|000029c0| 6e 74 20 66 69 6e 69 74 | 65 20 73 65 74 73 20 6f |nt finit|e sets o|
|000029d0| 66 20 6f 62 6a 65 63 74 | 73 20 69 6e 64 65 78 65 |f object|s indexe|
|000029e0| 64 20 62 79 20 61 72 62 | 69 74 72 61 72 79 20 69 |d by arb|itrary i|
|000029f0| 6e 64 65 78 20 73 65 74 | 73 2e 0d 54 68 65 20 73 |ndex set|s..The s|
|00002a00| 75 62 73 63 72 69 70 74 | 20 6e 6f 74 61 74 69 6f |ubscript| notatio|
|00002a10| 6e 20 5c 76 65 72 62 40 | 61 5b 6b 5d 40 20 73 65 |n \verb@|a[k]@ se|
|00002a20| 6c 65 63 74 73 20 74 68 | 65 20 65 6c 65 6d 65 6e |lects th|e elemen|
|00002a30| 74 20 69 6e 64 65 78 65 | 64 0d 62 79 20 5c 76 65 |t indexe|d.by \ve|
|00002a40| 72 62 40 6b 40 20 66 72 | 6f 6d 20 74 68 65 20 6d |rb@k@ fr|om the m|
|00002a50| 61 70 70 69 6e 67 20 5c | 76 65 72 62 40 61 40 3b |apping \|verb@a@;|
|00002a60| 20 74 68 69 73 20 63 61 | 6e 20 62 65 20 75 73 65 | this ca|n be use|
|00002a70| 64 20 69 6e 0d 65 78 70 | 72 65 73 73 69 6f 6e 73 |d in.exp|ressions|
|00002a80| 20 61 6e 64 20 61 73 20 | 74 68 65 20 74 61 72 67 | and as |the targ|
|00002a90| 65 74 20 6f 66 20 61 73 | 73 69 67 6e 6d 65 6e 74 |et of as|signment|
|00002aa0| 73 20 6f 72 20 5c 76 65 | 72 62 40 64 65 6c 40 20 |s or \ve|rb@del@ |
|00002ab0| 73 74 61 74 65 6d 65 6e | 74 73 2e 0d 54 68 65 20 |statemen|ts..The |
|00002ac0| 62 75 69 6c 74 2d 69 6e | 20 66 75 6e 63 74 69 6f |built-in| functio|
|00002ad0| 6e 20 5c 76 65 72 62 40 | 6c 65 6e 28 29 40 20 72 |n \verb@|len()@ r|
|00002ae0| 65 74 75 72 6e 73 20 74 | 68 65 20 6e 75 6d 62 65 |eturns t|he numbe|
|00002af0| 72 20 6f 66 20 65 6c 65 | 6d 65 6e 74 73 0d 69 6e |r of ele|ments.in|
|00002b00| 20 61 20 6d 61 70 70 69 | 6e 67 2e 0d 5c 62 69 66 | a mappi|ng..\bif|
|00002b10| 75 6e 63 69 6e 64 65 78 | 7b 6c 65 6e 7d 0d 5c 69 |uncindex|{len}.\i|
|00002b20| 6e 64 65 78 7b 73 75 62 | 73 63 72 69 70 74 69 6f |ndex{sub|scriptio|
|00002b30| 6e 7d 0d 5c 6f 62 69 6e | 64 65 78 7b 6d 61 70 70 |n}.\obin|dex{mapp|
|00002b40| 69 6e 67 7d 0d 0d 54 68 | 65 72 65 20 69 73 20 63 |ing}..Th|ere is c|
|00002b50| 75 72 72 65 6e 74 6c 79 | 20 61 20 73 69 6e 67 6c |urrently| a singl|
|00002b60| 65 20 6d 61 70 70 69 6e | 67 20 74 79 70 65 3a 0d |e mappin|g type:.|
|00002b70| 0d 5c 62 65 67 69 6e 7b | 64 65 73 63 72 69 70 74 |.\begin{|descript|
|00002b80| 69 6f 6e 7d 0d 0d 5c 69 | 74 65 6d 5b 44 69 63 74 |ion}..\i|tem[Dict|
|00002b90| 69 6f 6e 61 72 69 65 73 | 5d 0d 54 68 65 73 65 20 |ionaries|].These |
|00002ba0| 72 65 70 72 65 73 65 6e | 74 20 66 69 6e 69 74 65 |represen|t finite|
|00002bb0| 20 73 65 74 73 20 6f 66 | 20 6f 62 6a 65 63 74 73 | sets of| objects|
|00002bc0| 20 69 6e 64 65 78 65 64 | 20 62 79 20 61 6c 6d 6f | indexed| by almo|
|00002bd0| 73 74 20 61 72 62 69 74 | 72 61 72 79 0d 76 61 6c |st arbit|rary.val|
|00002be0| 75 65 73 2e 20 20 54 68 | 65 20 6f 6e 6c 79 20 74 |ues. Th|e only t|
|00002bf0| 79 70 65 73 20 6f 66 20 | 76 61 6c 75 65 73 20 6e |ypes of |values n|
|00002c00| 6f 74 20 61 63 63 65 70 | 74 61 62 6c 65 20 61 73 |ot accep|table as|
|00002c10| 20 6b 65 79 73 20 61 72 | 65 20 76 61 6c 75 65 73 | keys ar|e values|
|00002c20| 0d 63 6f 6e 74 61 69 6e | 69 6e 67 20 6c 69 73 74 |.contain|ing list|
|00002c30| 73 20 6f 72 20 64 69 63 | 74 69 6f 6e 61 72 69 65 |s or dic|tionarie|
|00002c40| 73 20 6f 72 20 6f 74 68 | 65 72 20 6d 75 74 61 62 |s or oth|er mutab|
|00002c50| 6c 65 20 74 79 70 65 73 | 20 74 68 61 74 20 61 72 |le types| that ar|
|00002c60| 65 0d 63 6f 6d 70 61 72 | 65 64 20 62 79 20 76 61 |e.compar|ed by va|
|00002c70| 6c 75 65 20 72 61 74 68 | 65 72 20 74 68 61 6e 20 |lue rath|er than |
|00002c80| 62 79 20 6f 62 6a 65 63 | 74 20 69 64 65 6e 74 69 |by objec|t identi|
|00002c90| 74 79 20 2d 2d 2d 20 74 | 68 65 20 72 65 61 73 6f |ty --- t|he reaso|
|00002ca0| 6e 20 62 65 69 6e 67 0d | 74 68 61 74 20 74 68 65 |n being.|that the|
|00002cb0| 20 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 20 | impleme|ntation |
|00002cc0| 72 65 71 75 69 72 65 73 | 20 74 68 61 74 20 61 20 |requires| that a |
|00002cd0| 6b 65 79 27 73 20 68 61 | 73 68 20 76 61 6c 75 65 |key's ha|sh value|
|00002ce0| 20 62 65 20 63 6f 6e 73 | 74 61 6e 74 2e 0d 4e 75 | be cons|tant..Nu|
|00002cf0| 6d 65 72 69 63 20 74 79 | 70 65 73 20 75 73 65 64 |meric ty|pes used|
|00002d00| 20 66 6f 72 20 6b 65 79 | 73 20 6f 62 65 79 20 74 | for key|s obey t|
|00002d10| 68 65 20 6e 6f 72 6d 61 | 6c 20 72 75 6c 65 73 20 |he norma|l rules |
|00002d20| 66 6f 72 20 6e 75 6d 65 | 72 69 63 0d 63 6f 6d 70 |for nume|ric.comp|
|00002d30| 61 72 69 73 6f 6e 3a 20 | 69 66 20 74 77 6f 20 6e |arison: |if two n|
|00002d40| 75 6d 62 65 72 73 20 63 | 6f 6d 70 61 72 65 20 65 |umbers c|ompare e|
|00002d50| 71 75 61 6c 20 28 65 2e | 67 2e 20 31 20 61 6e 64 |qual (e.|g. 1 and|
|00002d60| 20 31 2e 30 29 20 74 68 | 65 6e 20 74 68 65 79 0d | 1.0) th|en they.|
|00002d70| 63 61 6e 20 62 65 20 75 | 73 65 64 20 69 6e 74 65 |can be u|sed inte|
|00002d80| 72 63 68 61 6e 67 65 61 | 62 6c 79 20 74 6f 20 69 |rchangea|bly to i|
|00002d90| 6e 64 65 78 20 74 68 65 | 20 73 61 6d 65 20 64 69 |ndex the| same di|
|00002da0| 63 74 69 6f 6e 61 72 79 | 20 65 6e 74 72 79 2e 0d |ctionary| entry..|
|00002db0| 0d 44 69 63 74 69 6f 6e | 61 72 69 65 73 20 61 72 |.Diction|aries ar|
|00002dc0| 65 20 6d 75 74 61 62 6c | 65 3b 20 74 68 65 79 20 |e mutabl|e; they |
|00002dd0| 61 72 65 20 63 72 65 61 | 74 65 64 20 62 79 20 74 |are crea|ted by t|
|00002de0| 68 65 20 5c 76 65 72 62 | 40 7b 2e 2e 2e 7d 40 0d |he \verb|@{...}@.|
|00002df0| 6e 6f 74 61 74 69 6f 6e | 20 28 73 65 65 20 73 65 |notation| (see se|
|00002e00| 63 74 69 6f 6e 20 5c 72 | 65 66 7b 64 69 63 74 7d |ction \r|ef{dict}|
|00002e10| 29 2e 0d 5c 6f 62 69 6e | 64 65 78 7b 64 69 63 74 |)..\obin|dex{dict|
|00002e20| 69 6f 6e 61 72 79 7d 0d | 5c 6f 62 69 6e 64 65 78 |ionary}.|\obindex|
|00002e30| 7b 6d 75 74 61 62 6c 65 | 7d 0d 0d 5c 65 6e 64 7b |{mutable|}..\end{|
|00002e40| 64 65 73 63 72 69 70 74 | 69 6f 6e 7d 20 25 20 4d |descript|ion} % M|
|00002e50| 61 70 70 69 6e 67 20 74 | 79 70 65 73 0d 0d 5c 69 |apping t|ypes..\i|
|00002e60| 74 65 6d 5b 43 61 6c 6c | 61 62 6c 65 20 74 79 70 |tem[Call|able typ|
|00002e70| 65 73 5d 0d 54 68 65 73 | 65 20 61 72 65 20 74 68 |es].Thes|e are th|
|00002e80| 65 20 74 79 70 65 73 20 | 74 6f 20 77 68 69 63 68 |e types |to which|
|00002e90| 20 74 68 65 20 66 75 6e | 63 74 69 6f 6e 20 63 61 | the fun|ction ca|
|00002ea0| 6c 6c 20 28 69 6e 76 6f | 63 61 74 69 6f 6e 29 20 |ll (invo|cation) |
|00002eb0| 6f 70 65 72 61 74 69 6f | 6e 2c 0d 77 72 69 74 74 |operatio|n,.writt|
|00002ec0| 65 6e 20 61 73 20 5c 76 | 65 72 62 40 66 75 6e 63 |en as \v|erb@func|
|00002ed0| 74 69 6f 6e 28 61 72 67 | 75 6d 65 6e 74 2c 20 61 |tion(arg|ument, a|
|00002ee0| 72 67 75 6d 65 6e 74 2c | 20 2e 2e 2e 29 40 2c 20 |rgument,| ...)@, |
|00002ef0| 63 61 6e 20 62 65 20 61 | 70 70 6c 69 65 64 3a 0d |can be a|pplied:.|
|00002f00| 5c 69 6e 64 65 78 69 69 | 7b 66 75 6e 63 74 69 6f |\indexii|{functio|
|00002f10| 6e 7d 7b 63 61 6c 6c 7d | 0d 5c 69 6e 64 65 78 7b |n}{call}|.\index{|
|00002f20| 69 6e 76 6f 63 61 74 69 | 6f 6e 7d 0d 5c 69 6e 64 |invocati|on}.\ind|
|00002f30| 65 78 69 69 7b 66 75 6e | 63 74 69 6f 6e 7d 7b 61 |exii{fun|ction}{a|
|00002f40| 72 67 75 6d 65 6e 74 7d | 0d 5c 6f 62 69 6e 64 65 |rgument}|.\obinde|
|00002f50| 78 7b 63 61 6c 6c 61 62 | 6c 65 7d 0d 0d 5c 62 65 |x{callab|le}..\be|
|00002f60| 67 69 6e 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |gin{desc|ription}|
|00002f70| 0d 0d 5c 69 74 65 6d 5b | 55 73 65 72 2d 64 65 66 |..\item[|User-def|
|00002f80| 69 6e 65 64 20 66 75 6e | 63 74 69 6f 6e 73 5d 0d |ined fun|ctions].|
|00002f90| 41 20 75 73 65 72 2d 64 | 65 66 69 6e 65 64 20 66 |A user-d|efined f|
|00002fa0| 75 6e 63 74 69 6f 6e 20 | 6f 62 6a 65 63 74 20 69 |unction |object i|
|00002fb0| 73 20 63 72 65 61 74 65 | 64 20 62 79 20 61 20 66 |s create|d by a f|
|00002fc0| 75 6e 63 74 69 6f 6e 20 | 64 65 66 69 6e 69 74 69 |unction |definiti|
|00002fd0| 6f 6e 0d 28 73 65 65 20 | 73 65 63 74 69 6f 6e 20 |on.(see |section |
|00002fe0| 5c 72 65 66 7b 66 75 6e | 63 74 69 6f 6e 7d 29 2e |\ref{fun|ction}).|
|00002ff0| 20 20 49 74 20 73 68 6f | 75 6c 64 20 62 65 20 63 | It sho|uld be c|
|00003000| 61 6c 6c 65 64 20 77 69 | 74 68 20 61 6e 20 61 72 |alled wi|th an ar|
|00003010| 67 75 6d 65 6e 74 0d 6c | 69 73 74 20 63 6f 6e 74 |gument.l|ist cont|
|00003020| 61 69 6e 69 6e 67 20 74 | 68 65 20 73 61 6d 65 20 |aining t|he same |
|00003030| 6e 75 6d 62 65 72 20 6f | 66 20 69 74 65 6d 73 20 |number o|f items |
|00003040| 61 73 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 27 |as the f|unction'|
|00003050| 73 20 66 6f 72 6d 61 6c | 0d 70 61 72 61 6d 65 74 |s formal|.paramet|
|00003060| 65 72 20 6c 69 73 74 2e | 0d 5c 69 6e 64 65 78 69 |er list.|.\indexi|
|00003070| 69 7b 75 73 65 72 2d 64 | 65 66 69 6e 65 64 7d 7b |i{user-d|efined}{|
|00003080| 66 75 6e 63 74 69 6f 6e | 7d 0d 5c 6f 62 69 6e 64 |function|}.\obind|
|00003090| 65 78 7b 66 75 6e 63 74 | 69 6f 6e 7d 0d 5c 6f 62 |ex{funct|ion}.\ob|
|000030a0| 69 6e 64 65 78 7b 75 73 | 65 72 2d 64 65 66 69 6e |index{us|er-defin|
|000030b0| 65 64 20 66 75 6e 63 74 | 69 6f 6e 7d 0d 0d 53 70 |ed funct|ion}..Sp|
|000030c0| 65 63 69 61 6c 20 72 65 | 61 64 2d 6f 6e 6c 79 20 |ecial re|ad-only |
|000030d0| 61 74 74 72 69 62 75 74 | 65 73 3a 20 5c 76 65 72 |attribut|es: \ver|
|000030e0| 62 40 66 75 6e 63 5f 63 | 6f 64 65 40 20 69 73 20 |b@func_c|ode@ is |
|000030f0| 74 68 65 20 63 6f 64 65 | 20 6f 62 6a 65 63 74 0d |the code| object.|
|00003100| 72 65 70 72 65 73 65 6e | 74 69 6e 67 20 74 68 65 |represen|ting the|
|00003110| 20 63 6f 6d 70 69 6c 65 | 64 20 66 75 6e 63 74 69 | compile|d functi|
|00003120| 6f 6e 20 62 6f 64 79 2c | 20 61 6e 64 20 5c 76 65 |on body,| and \ve|
|00003130| 72 62 40 66 75 6e 63 5f | 67 6c 6f 62 61 6c 73 40 |rb@func_|globals@|
|00003140| 20 69 73 20 28 61 0d 72 | 65 66 65 72 65 6e 63 65 | is (a.r|eference|
|00003150| 20 74 6f 29 20 74 68 65 | 20 64 69 63 74 69 6f 6e | to) the| diction|
|00003160| 61 72 79 20 74 68 61 74 | 20 68 6f 6c 64 73 20 74 |ary that| holds t|
|00003170| 68 65 20 66 75 6e 63 74 | 69 6f 6e 27 73 20 67 6c |he funct|ion's gl|
|00003180| 6f 62 61 6c 0d 76 61 72 | 69 61 62 6c 65 73 20 2d |obal.var|iables -|
|00003190| 2d 2d 20 69 74 20 69 6d | 70 6c 65 6d 65 6e 74 73 |-- it im|plements|
|000031a0| 20 74 68 65 20 67 6c 6f | 62 61 6c 20 6e 61 6d 65 | the glo|bal name|
|000031b0| 20 73 70 61 63 65 20 6f | 66 20 74 68 65 20 6d 6f | space o|f the mo|
|000031c0| 64 75 6c 65 20 69 6e 0d | 77 68 69 63 68 20 74 68 |dule in.|which th|
|000031d0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 77 61 73 20 64 |e functi|on was d|
|000031e0| 65 66 69 6e 65 64 2e 0d | 5c 74 74 69 6e 64 65 78 |efined..|\ttindex|
|000031f0| 7b 66 75 6e 63 5f 63 6f | 64 65 7d 0d 5c 74 74 69 |{func_co|de}.\tti|
|00003200| 6e 64 65 78 7b 66 75 6e | 63 5f 67 6c 6f 62 61 6c |ndex{fun|c_global|
|00003210| 73 7d 0d 5c 69 6e 64 65 | 78 69 69 7b 67 6c 6f 62 |s}.\inde|xii{glob|
|00003220| 61 6c 7d 7b 6e 61 6d 65 | 20 73 70 61 63 65 7d 0d |al}{name| space}.|
|00003230| 0d 5c 69 74 65 6d 5b 55 | 73 65 72 2d 64 65 66 69 |.\item[U|ser-defi|
|00003240| 6e 65 64 20 6d 65 74 68 | 6f 64 73 5d 0d 41 20 75 |ned meth|ods].A u|
|00003250| 73 65 72 2d 64 65 66 69 | 6e 65 64 20 6d 65 74 68 |ser-defi|ned meth|
|00003260| 6f 64 20 28 61 2e 6b 2e | 61 2e 20 7b 5c 65 6d 20 |od (a.k.|a. {\em |
|00003270| 6f 62 6a 65 63 74 20 63 | 6c 6f 73 75 72 65 7d 29 |object c|losure})|
|00003280| 20 69 73 20 61 20 70 61 | 69 72 20 6f 66 20 61 0d | is a pa|ir of a.|
|00003290| 63 6c 61 73 73 20 69 6e | 73 74 61 6e 63 65 20 6f |class in|stance o|
|000032a0| 62 6a 65 63 74 20 61 6e | 64 20 61 20 75 73 65 72 |bject an|d a user|
|000032b0| 2d 64 65 66 69 6e 65 64 | 20 66 75 6e 63 74 69 6f |-defined| functio|
|000032c0| 6e 2e 20 20 49 74 20 73 | 68 6f 75 6c 64 20 62 65 |n. It s|hould be|
|000032d0| 0d 63 61 6c 6c 65 64 20 | 77 69 74 68 20 61 6e 20 |.called |with an |
|000032e0| 61 72 67 75 6d 65 6e 74 | 20 6c 69 73 74 20 63 6f |argument| list co|
|000032f0| 6e 74 61 69 6e 69 6e 67 | 20 6f 6e 65 20 69 74 65 |ntaining| one ite|
|00003300| 6d 20 6c 65 73 73 20 74 | 68 61 6e 20 74 68 65 20 |m less t|han the |
|00003310| 6e 75 6d 62 65 72 0d 6f | 66 20 69 74 65 6d 73 20 |number.o|f items |
|00003320| 69 6e 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 27 |in the f|unction'|
|00003330| 73 20 66 6f 72 6d 61 6c | 20 70 61 72 61 6d 65 74 |s formal| paramet|
|00003340| 65 72 20 6c 69 73 74 2e | 20 20 57 68 65 6e 20 63 |er list.| When c|
|00003350| 61 6c 6c 65 64 2c 20 74 | 68 65 0d 63 6c 61 73 73 |alled, t|he.class|
|00003360| 20 69 6e 73 74 61 6e 63 | 65 20 62 65 63 6f 6d 65 | instanc|e become|
|00003370| 73 20 74 68 65 20 66 69 | 72 73 74 20 61 72 67 75 |s the fi|rst argu|
|00003380| 6d 65 6e 74 2c 20 61 6e | 64 20 74 68 65 20 63 61 |ment, an|d the ca|
|00003390| 6c 6c 20 61 72 67 75 6d | 65 6e 74 73 20 61 72 65 |ll argum|ents are|
|000033a0| 0d 73 68 69 66 74 65 64 | 20 6f 6e 65 20 74 6f 20 |.shifted| one to |
|000033b0| 74 68 65 20 72 69 67 68 | 74 2e 0d 5c 6f 62 69 6e |the righ|t..\obin|
|000033c0| 64 65 78 7b 6d 65 74 68 | 6f 64 7d 0d 5c 6f 62 69 |dex{meth|od}.\obi|
|000033d0| 6e 64 65 78 7b 75 73 65 | 72 2d 64 65 66 69 6e 65 |ndex{use|r-define|
|000033e0| 64 20 6d 65 74 68 6f 64 | 7d 0d 5c 69 6e 64 65 78 |d method|}.\index|
|000033f0| 69 69 7b 75 73 65 72 2d | 64 65 66 69 6e 65 64 7d |ii{user-|defined}|
|00003400| 7b 6d 65 74 68 6f 64 7d | 0d 5c 69 6e 64 65 78 7b |{method}|.\index{|
|00003410| 6f 62 6a 65 63 74 20 63 | 6c 6f 73 75 72 65 7d 0d |object c|losure}.|
|00003420| 0d 53 70 65 63 69 61 6c | 20 72 65 61 64 2d 6f 6e |.Special| read-on|
|00003430| 6c 79 20 61 74 74 72 69 | 62 75 74 65 73 3a 20 5c |ly attri|butes: \|
|00003440| 76 65 72 62 40 69 6d 5f | 73 65 6c 66 40 20 69 73 |verb@im_|self@ is|
|00003450| 20 74 68 65 20 63 6c 61 | 73 73 20 69 6e 73 74 61 | the cla|ss insta|
|00003460| 6e 63 65 0d 6f 62 6a 65 | 63 74 2c 20 5c 76 65 72 |nce.obje|ct, \ver|
|00003470| 62 40 69 6d 5f 66 75 6e | 63 40 20 69 73 20 74 68 |b@im_fun|c@ is th|
|00003480| 65 20 66 75 6e 63 74 69 | 6f 6e 20 6f 62 6a 65 63 |e functi|on objec|
|00003490| 74 2e 0d 5c 74 74 69 6e | 64 65 78 7b 69 6d 5f 66 |t..\ttin|dex{im_f|
|000034a0| 75 6e 63 7d 0d 5c 74 74 | 69 6e 64 65 78 7b 69 6d |unc}.\tt|index{im|
|000034b0| 5f 73 65 6c 66 7d 0d 0d | 5c 69 74 65 6d 5b 42 75 |_self}..|\item[Bu|
|000034c0| 69 6c 74 2d 69 6e 20 66 | 75 6e 63 74 69 6f 6e 73 |ilt-in f|unctions|
|000034d0| 5d 0d 41 20 62 75 69 6c | 74 2d 69 6e 20 66 75 6e |].A buil|t-in fun|
|000034e0| 63 74 69 6f 6e 20 6f 62 | 6a 65 63 74 20 69 73 20 |ction ob|ject is |
|000034f0| 61 20 77 72 61 70 70 65 | 72 20 61 72 6f 75 6e 64 |a wrappe|r around|
|00003500| 20 61 20 43 20 66 75 6e | 63 74 69 6f 6e 2e 20 20 | a C fun|ction. |
|00003510| 45 78 61 6d 70 6c 65 73 | 0d 6f 66 20 62 75 69 6c |Examples|.of buil|
|00003520| 74 2d 69 6e 20 66 75 6e | 63 74 69 6f 6e 73 20 61 |t-in fun|ctions a|
|00003530| 72 65 20 5c 76 65 72 62 | 40 6c 65 6e 40 20 61 6e |re \verb|@len@ an|
|00003540| 64 20 5c 76 65 72 62 40 | 6d 61 74 68 2e 73 69 6e |d \verb@|math.sin|
|00003550| 40 2e 20 20 54 68 65 72 | 65 0d 61 72 65 20 6e 6f |@. Ther|e.are no|
|00003560| 20 73 70 65 63 69 61 6c | 20 61 74 74 72 69 62 75 | special| attribu|
|00003570| 74 65 73 2e 20 20 54 68 | 65 20 6e 75 6d 62 65 72 |tes. Th|e number|
|00003580| 20 61 6e 64 20 74 79 70 | 65 20 6f 66 20 74 68 65 | and typ|e of the|
|00003590| 20 61 72 67 75 6d 65 6e | 74 73 20 61 72 65 0d 64 | argumen|ts are.d|
|000035a0| 65 74 65 72 6d 69 6e 65 | 64 20 62 79 20 74 68 65 |etermine|d by the|
|000035b0| 20 43 20 66 75 6e 63 74 | 69 6f 6e 2e 0d 5c 6f 62 | C funct|ion..\ob|
|000035c0| 69 6e 64 65 78 7b 62 75 | 69 6c 74 2d 69 6e 20 66 |index{bu|ilt-in f|
|000035d0| 75 6e 63 74 69 6f 6e 7d | 0d 5c 6f 62 69 6e 64 65 |unction}|.\obinde|
|000035e0| 78 7b 66 75 6e 63 74 69 | 6f 6e 7d 0d 5c 69 6e 64 |x{functi|on}.\ind|
|000035f0| 65 78 7b 43 7d 0d 0d 5c | 69 74 65 6d 5b 42 75 69 |ex{C}..\|item[Bui|
|00003600| 6c 74 2d 69 6e 20 6d 65 | 74 68 6f 64 73 5d 0d 54 |lt-in me|thods].T|
|00003610| 68 69 73 20 69 73 20 72 | 65 61 6c 6c 79 20 61 20 |his is r|eally a |
|00003620| 64 69 66 66 65 72 65 6e | 74 20 64 69 73 67 75 69 |differen|t disgui|
|00003630| 73 65 20 6f 66 20 61 20 | 62 75 69 6c 74 2d 69 6e |se of a |built-in|
|00003640| 20 66 75 6e 63 74 69 6f | 6e 2c 20 74 68 69 73 20 | functio|n, this |
|00003650| 74 69 6d 65 0d 63 6f 6e | 74 61 69 6e 69 6e 67 20 |time.con|taining |
|00003660| 61 6e 20 6f 62 6a 65 63 | 74 20 70 61 73 73 65 64 |an objec|t passed|
|00003670| 20 74 6f 20 74 68 65 20 | 43 20 66 75 6e 63 74 69 | to the |C functi|
|00003680| 6f 6e 20 61 73 20 61 6e | 20 69 6d 70 6c 69 63 69 |on as an| implici|
|00003690| 74 20 65 78 74 72 61 0d | 61 72 67 75 6d 65 6e 74 |t extra.|argument|
|000036a0| 2e 20 20 41 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |. An ex|ample of|
|000036b0| 20 61 20 62 75 69 6c 74 | 2d 69 6e 20 6d 65 74 68 | a built|-in meth|
|000036c0| 6f 64 20 69 73 20 5c 76 | 65 72 62 40 6c 69 73 74 |od is \v|erb@list|
|000036d0| 2e 61 70 70 65 6e 64 40 | 20 69 66 0d 5c 76 65 72 |.append@| if.\ver|
|000036e0| 62 40 6c 69 73 74 40 20 | 69 73 20 61 20 6c 69 73 |b@list@ |is a lis|
|000036f0| 74 20 6f 62 6a 65 63 74 | 2e 0d 5c 6f 62 69 6e 64 |t object|..\obind|
|00003700| 65 78 7b 62 75 69 6c 74 | 2d 69 6e 20 6d 65 74 68 |ex{built|-in meth|
|00003710| 6f 64 7d 0d 5c 6f 62 69 | 6e 64 65 78 7b 6d 65 74 |od}.\obi|ndex{met|
|00003720| 68 6f 64 7d 0d 5c 69 6e | 64 65 78 69 69 7b 62 75 |hod}.\in|dexii{bu|
|00003730| 69 6c 74 2d 69 6e 7d 7b | 6d 65 74 68 6f 64 7d 0d |ilt-in}{|method}.|
|00003740| 0d 5c 69 74 65 6d 5b 43 | 6c 61 73 73 65 73 5d 0d |.\item[C|lasses].|
|00003750| 43 6c 61 73 73 20 6f 62 | 6a 65 63 74 73 20 61 72 |Class ob|jects ar|
|00003760| 65 20 64 65 73 63 72 69 | 62 65 64 20 62 65 6c 6f |e descri|bed belo|
|00003770| 77 2e 20 20 57 68 65 6e | 20 61 20 63 6c 61 73 73 |w. When| a class|
|00003780| 20 6f 62 6a 65 63 74 20 | 69 73 20 63 61 6c 6c 65 | object |is calle|
|00003790| 64 20 61 73 20 61 0d 66 | 75 6e 63 74 69 6f 6e 2c |d as a.f|unction,|
|000037a0| 20 61 20 6e 65 77 20 63 | 6c 61 73 73 20 69 6e 73 | a new c|lass ins|
|000037b0| 74 61 6e 63 65 20 28 61 | 6c 73 6f 20 64 65 73 63 |tance (a|lso desc|
|000037c0| 72 69 62 65 64 20 62 65 | 6c 6f 77 29 20 69 73 20 |ribed be|low) is |
|000037d0| 63 72 65 61 74 65 64 20 | 61 6e 64 0d 72 65 74 75 |created |and.retu|
|000037e0| 72 6e 65 64 2e 20 20 54 | 68 69 73 20 69 6d 70 6c |rned. T|his impl|
|000037f0| 69 65 73 20 61 20 63 61 | 6c 6c 20 74 6f 20 74 68 |ies a ca|ll to th|
|00003800| 65 20 63 6c 61 73 73 27 | 73 20 5c 76 65 72 62 40 |e class'|s \verb@|
|00003810| 5f 5f 69 6e 69 74 5f 5f | 40 20 6d 65 74 68 6f 64 |__init__|@ method|
|00003820| 0d 69 66 20 69 74 20 68 | 61 73 20 6f 6e 65 2e 20 |.if it h|as one. |
|00003830| 20 41 6e 79 20 61 72 67 | 75 6d 65 6e 74 73 20 61 | Any arg|uments a|
|00003840| 72 65 20 70 61 73 73 65 | 64 20 6f 6e 20 74 6f 20 |re passe|d on to |
|00003850| 74 68 65 20 5c 76 65 72 | 62 40 5f 5f 69 6e 69 74 |the \ver|b@__init|
|00003860| 5f 5f 40 0d 6d 65 74 68 | 6f 64 20 2d 2d 20 69 66 |__@.meth|od -- if|
|00003870| 20 74 68 65 72 65 20 69 | 73 20 5c 76 65 72 62 40 | there i|s \verb@|
|00003880| 5f 5f 69 6e 69 74 5f 5f | 40 20 6d 65 74 68 6f 64 |__init__|@ method|
|00003890| 2c 20 74 68 65 20 63 6c | 61 73 73 20 6d 75 73 74 |, the cl|ass must|
|000038a0| 20 62 65 20 63 61 6c 6c | 65 64 0d 77 69 74 68 6f | be call|ed.witho|
|000038b0| 75 74 20 61 72 67 75 6d | 65 6e 74 73 2e 0d 5c 74 |ut argum|ents..\t|
|000038c0| 74 69 6e 64 65 78 7b 5f | 5f 69 6e 69 74 5f 5f 7d |tindex{_|_init__}|
|000038d0| 0d 5c 6f 62 69 6e 64 65 | 78 7b 63 6c 61 73 73 7d |.\obinde|x{class}|
|000038e0| 0d 5c 6f 62 69 6e 64 65 | 78 7b 63 6c 61 73 73 20 |.\obinde|x{class |
|000038f0| 69 6e 73 74 61 6e 63 65 | 7d 0d 5c 6f 62 69 6e 64 |instance|}.\obind|
|00003900| 65 78 7b 69 6e 73 74 61 | 6e 63 65 7d 0d 5c 69 6e |ex{insta|nce}.\in|
|00003910| 64 65 78 69 69 7b 63 6c | 61 73 73 20 6f 62 6a 65 |dexii{cl|ass obje|
|00003920| 63 74 7d 7b 63 61 6c 6c | 7d 0d 0d 5c 65 6e 64 7b |ct}{call|}..\end{|
|00003930| 64 65 73 63 72 69 70 74 | 69 6f 6e 7d 0d 0d 5c 69 |descript|ion}..\i|
|00003940| 74 65 6d 5b 4d 6f 64 75 | 6c 65 73 5d 0d 4d 6f 64 |tem[Modu|les].Mod|
|00003950| 75 6c 65 73 20 61 72 65 | 20 69 6d 70 6f 72 74 65 |ules are| importe|
|00003960| 64 20 62 79 20 74 68 65 | 20 5c 76 65 72 62 40 69 |d by the| \verb@i|
|00003970| 6d 70 6f 72 74 40 20 73 | 74 61 74 65 6d 65 6e 74 |mport@ s|tatement|
|00003980| 20 28 73 65 65 20 73 65 | 63 74 69 6f 6e 0d 5c 72 | (see se|ction.\r|
|00003990| 65 66 7b 69 6d 70 6f 72 | 74 7d 29 2e 20 20 41 20 |ef{impor|t}). A |
|000039a0| 6d 6f 64 75 6c 65 20 6f | 62 6a 65 63 74 20 69 73 |module o|bject is|
|000039b0| 20 61 20 63 6f 6e 74 61 | 69 6e 65 72 20 66 6f 72 | a conta|iner for|
|000039c0| 20 61 20 6d 6f 64 75 6c | 65 27 73 20 6e 61 6d 65 | a modul|e's name|
|000039d0| 0d 73 70 61 63 65 2c 20 | 77 68 69 63 68 20 69 73 |.space, |which is|
|000039e0| 20 61 20 64 69 63 74 69 | 6f 6e 61 72 79 20 28 74 | a dicti|onary (t|
|000039f0| 68 65 20 73 61 6d 65 20 | 64 69 63 74 69 6f 6e 61 |he same |dictiona|
|00003a00| 72 79 20 61 73 20 72 65 | 66 65 72 65 6e 63 65 64 |ry as re|ferenced|
|00003a10| 20 62 79 20 74 68 65 0d | 5c 76 65 72 62 40 66 75 | by the.|\verb@fu|
|00003a20| 6e 63 5f 67 6c 6f 62 61 | 6c 73 40 20 61 74 74 72 |nc_globa|ls@ attr|
|00003a30| 69 62 75 74 65 20 6f 66 | 20 66 75 6e 63 74 69 6f |ibute of| functio|
|00003a40| 6e 73 20 64 65 66 69 6e | 65 64 20 69 6e 20 74 68 |ns defin|ed in th|
|00003a50| 65 20 6d 6f 64 75 6c 65 | 29 2e 0d 4d 6f 64 75 6c |e module|)..Modul|
|00003a60| 65 20 61 74 74 72 69 62 | 75 74 65 20 72 65 66 65 |e attrib|ute refe|
|00003a70| 72 65 6e 63 65 73 20 61 | 72 65 20 74 72 61 6e 73 |rences a|re trans|
|00003a80| 6c 61 74 65 64 20 74 6f | 20 6c 6f 6f 6b 75 70 73 |lated to| lookups|
|00003a90| 20 69 6e 20 74 68 69 73 | 0d 64 69 63 74 69 6f 6e | in this|.diction|
|00003aa0| 61 72 79 2e 20 20 41 20 | 6d 6f 64 75 6c 65 20 6f |ary. A |module o|
|00003ab0| 62 6a 65 63 74 20 64 6f | 65 73 20 6e 6f 74 20 63 |bject do|es not c|
|00003ac0| 6f 6e 74 61 69 6e 20 74 | 68 65 20 63 6f 64 65 20 |ontain t|he code |
|00003ad0| 6f 62 6a 65 63 74 20 75 | 73 65 64 20 74 6f 0d 69 |object u|sed to.i|
|00003ae0| 6e 69 74 69 61 6c 69 7a | 65 20 74 68 65 20 6d 6f |nitializ|e the mo|
|00003af0| 64 75 6c 65 20 28 73 69 | 6e 63 65 20 69 74 20 69 |dule (si|nce it i|
|00003b00| 73 6e 27 74 20 6e 65 65 | 64 65 64 20 6f 6e 63 65 |sn't nee|ded once|
|00003b10| 20 74 68 65 20 69 6e 69 | 74 69 61 6c 69 7a 61 74 | the ini|tializat|
|00003b20| 69 6f 6e 0d 69 73 20 64 | 6f 6e 65 29 2e 0d 5c 73 |ion.is d|one)..\s|
|00003b30| 74 69 6e 64 65 78 7b 69 | 6d 70 6f 72 74 7d 0d 5c |tindex{i|mport}.\|
|00003b40| 6f 62 69 6e 64 65 78 7b | 6d 6f 64 75 6c 65 7d 0d |obindex{|module}.|
|00003b50| 0d 41 74 74 72 69 62 75 | 74 65 20 61 73 73 69 67 |.Attribu|te assig|
|00003b60| 6e 6d 65 6e 74 20 75 70 | 64 61 74 65 20 74 68 65 |nment up|date the|
|00003b70| 20 6d 6f 64 75 6c 65 27 | 73 20 6e 61 6d 65 20 73 | module'|s name s|
|00003b80| 70 61 63 65 20 64 69 63 | 74 69 6f 6e 61 72 79 2e |pace dic|tionary.|
|00003b90| 0d 0d 53 70 65 63 69 61 | 6c 20 72 65 61 64 2d 6f |..Specia|l read-o|
|00003ba0| 6e 6c 79 20 61 74 74 72 | 69 62 75 74 65 73 3a 20 |nly attr|ibutes: |
|00003bb0| 5c 76 65 72 62 40 5f 5f | 64 69 63 74 5f 5f 40 20 |\verb@__|dict__@ |
|00003bc0| 79 69 65 6c 64 73 20 74 | 68 65 20 6d 6f 64 75 6c |yields t|he modul|
|00003bd0| 65 27 73 20 6e 61 6d 65 | 0d 73 70 61 63 65 20 61 |e's name|.space a|
|00003be0| 73 20 61 20 64 69 63 74 | 69 6f 6e 61 72 79 20 6f |s a dict|ionary o|
|00003bf0| 62 6a 65 63 74 3b 20 5c | 76 65 72 62 40 5f 5f 6e |bject; \|verb@__n|
|00003c00| 61 6d 65 5f 5f 40 20 79 | 69 65 6c 64 73 20 74 68 |ame__@ y|ields th|
|00003c10| 65 20 6d 6f 64 75 6c 65 | 27 73 20 6e 61 6d 65 0d |e module|'s name.|
|00003c20| 61 73 20 61 20 73 74 72 | 69 6e 67 20 6f 62 6a 65 |as a str|ing obje|
|00003c30| 63 74 2e 0d 5c 74 74 69 | 6e 64 65 78 7b 5f 5f 64 |ct..\tti|ndex{__d|
|00003c40| 69 63 74 5f 5f 7d 0d 5c | 74 74 69 6e 64 65 78 7b |ict__}.\|ttindex{|
|00003c50| 5f 5f 6e 61 6d 65 5f 5f | 7d 0d 5c 69 6e 64 65 78 |__name__|}.\index|
|00003c60| 69 69 7b 6d 6f 64 75 6c | 65 7d 7b 6e 61 6d 65 20 |ii{modul|e}{name |
|00003c70| 73 70 61 63 65 7d 0d 0d | 5c 69 74 65 6d 5b 43 6c |space}..|\item[Cl|
|00003c80| 61 73 73 65 73 5d 0d 43 | 6c 61 73 73 20 6f 62 6a |asses].C|lass obj|
|00003c90| 65 63 74 73 20 61 72 65 | 20 63 72 65 61 74 65 64 |ects are| created|
|00003ca0| 20 62 79 20 63 6c 61 73 | 73 20 64 65 66 69 6e 69 | by clas|s defini|
|00003cb0| 74 69 6f 6e 73 20 28 73 | 65 65 20 73 65 63 74 69 |tions (s|ee secti|
|00003cc0| 6f 6e 0d 5c 72 65 66 7b | 63 6c 61 73 73 7d 29 2e |on.\ref{|class}).|
|00003cd0| 20 20 41 20 63 6c 61 73 | 73 20 69 73 20 61 20 63 | A clas|s is a c|
|00003ce0| 6f 6e 74 61 69 6e 65 72 | 20 66 6f 72 20 61 20 64 |ontainer| for a d|
|00003cf0| 69 63 74 69 6f 6e 61 72 | 79 20 63 6f 6e 74 61 69 |ictionar|y contai|
|00003d00| 6e 69 6e 67 20 74 68 65 | 0d 63 6c 61 73 73 27 73 |ning the|.class's|
|00003d10| 20 6e 61 6d 65 20 73 70 | 61 63 65 2e 20 20 43 6c | name sp|ace. Cl|
|00003d20| 61 73 73 20 61 74 74 72 | 69 62 75 74 65 20 72 65 |ass attr|ibute re|
|00003d30| 66 65 72 65 6e 63 65 73 | 20 61 72 65 20 74 72 61 |ferences| are tra|
|00003d40| 6e 73 6c 61 74 65 64 20 | 74 6f 0d 6c 6f 6f 6b 75 |nslated |to.looku|
|00003d50| 70 73 20 69 6e 20 74 68 | 69 73 20 64 69 63 74 69 |ps in th|is dicti|
|00003d60| 6f 6e 61 72 79 2e 20 20 | 57 68 65 6e 20 61 6e 20 |onary. |When an |
|00003d70| 61 74 74 72 69 62 75 74 | 65 20 6e 61 6d 65 20 69 |attribut|e name i|
|00003d80| 73 20 6e 6f 74 20 66 6f | 75 6e 64 0d 74 68 65 72 |s not fo|und.ther|
|00003d90| 65 2c 20 74 68 65 20 61 | 74 74 72 69 62 75 74 65 |e, the a|ttribute|
|00003da0| 20 73 65 61 72 63 68 20 | 63 6f 6e 74 69 6e 75 65 | search |continue|
|00003db0| 73 20 69 6e 20 74 68 65 | 20 62 61 73 65 20 63 6c |s in the| base cl|
|00003dc0| 61 73 73 65 73 2e 20 20 | 54 68 65 20 73 65 61 72 |asses. |The sear|
|00003dd0| 63 68 0d 69 73 20 64 65 | 70 74 68 2d 66 69 72 73 |ch.is de|pth-firs|
|00003de0| 74 2c 20 6c 65 66 74 2d | 74 6f 2d 72 69 67 68 74 |t, left-|to-right|
|00003df0| 20 69 6e 20 74 68 65 20 | 6f 72 64 65 72 20 6f 66 | in the |order of|
|00003e00| 20 74 68 65 69 72 20 6f | 63 63 75 72 72 65 6e 63 | their o|ccurrenc|
|00003e10| 65 20 69 6e 20 74 68 65 | 0d 62 61 73 65 20 63 6c |e in the|.base cl|
|00003e20| 61 73 73 20 6c 69 73 74 | 2e 0d 5c 6f 62 69 6e 64 |ass list|..\obind|
|00003e30| 65 78 7b 63 6c 61 73 73 | 7d 0d 5c 6f 62 69 6e 64 |ex{class|}.\obind|
|00003e40| 65 78 7b 63 6c 61 73 73 | 20 69 6e 73 74 61 6e 63 |ex{class| instanc|
|00003e50| 65 7d 0d 5c 6f 62 69 6e | 64 65 78 7b 69 6e 73 74 |e}.\obin|dex{inst|
|00003e60| 61 6e 63 65 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 63 |ance}.\i|ndexii{c|
|00003e70| 6c 61 73 73 20 6f 62 6a | 65 63 74 7d 7b 63 61 6c |lass obj|ect}{cal|
|00003e80| 6c 7d 0d 5c 69 6e 64 65 | 78 7b 63 6f 6e 74 61 69 |l}.\inde|x{contai|
|00003e90| 6e 65 72 7d 0d 5c 6f 62 | 69 6e 64 65 78 7b 64 69 |ner}.\ob|index{di|
|00003ea0| 63 74 69 6f 6e 61 72 79 | 7d 0d 5c 69 6e 64 65 78 |ctionary|}.\index|
|00003eb0| 69 69 7b 63 6c 61 73 73 | 7d 7b 61 74 74 72 69 62 |ii{class|}{attrib|
|00003ec0| 75 74 65 7d 0d 0d 43 6c | 61 73 73 20 61 74 74 72 |ute}..Cl|ass attr|
|00003ed0| 69 62 75 74 65 20 61 73 | 73 69 67 6e 6d 65 6e 74 |ibute as|signment|
|00003ee0| 73 20 75 70 64 61 74 65 | 20 74 68 65 20 63 6c 61 |s update| the cla|
|00003ef0| 73 73 27 73 20 64 69 63 | 74 69 6f 6e 61 72 79 2c |ss's dic|tionary,|
|00003f00| 20 6e 65 76 65 72 20 74 | 68 65 0d 64 69 63 74 69 | never t|he.dicti|
|00003f10| 6f 6e 61 72 79 20 6f 66 | 20 61 20 62 61 73 65 20 |onary of| a base |
|00003f20| 63 6c 61 73 73 2e 0d 5c | 69 6e 64 65 78 69 69 69 |class..\|indexiii|
|00003f30| 7b 63 6c 61 73 73 7d 7b | 61 74 74 72 69 62 75 74 |{class}{|attribut|
|00003f40| 65 7d 7b 61 73 73 69 67 | 6e 6d 65 6e 74 7d 0d 0d |e}{assig|nment}..|
|00003f50| 41 20 63 6c 61 73 73 20 | 63 61 6e 20 62 65 20 63 |A class |can be c|
|00003f60| 61 6c 6c 65 64 20 61 73 | 20 61 20 66 75 6e 63 74 |alled as| a funct|
|00003f70| 69 6f 6e 20 74 6f 20 79 | 69 65 6c 64 20 61 20 63 |ion to y|ield a c|
|00003f80| 6c 61 73 73 20 69 6e 73 | 74 61 6e 63 65 20 28 73 |lass ins|tance (s|
|00003f90| 65 65 0d 61 62 6f 76 65 | 29 2e 0d 5c 69 6e 64 65 |ee.above|)..\inde|
|00003fa0| 78 69 69 7b 63 6c 61 73 | 73 20 6f 62 6a 65 63 74 |xii{clas|s object|
|00003fb0| 7d 7b 63 61 6c 6c 7d 0d | 0d 53 70 65 63 69 61 6c |}{call}.|.Special|
|00003fc0| 20 72 65 61 64 2d 6f 6e | 6c 79 20 61 74 74 72 69 | read-on|ly attri|
|00003fd0| 62 75 74 65 73 3a 20 5c | 76 65 72 62 40 5f 5f 64 |butes: \|verb@__d|
|00003fe0| 69 63 74 5f 5f 40 20 79 | 69 65 6c 64 73 20 74 68 |ict__@ y|ields th|
|00003ff0| 65 20 64 69 63 74 69 6f | 6e 61 72 79 0d 63 6f 6e |e dictio|nary.con|
|00004000| 74 61 69 6e 69 6e 67 20 | 74 68 65 20 63 6c 61 73 |taining |the clas|
|00004010| 73 27 73 20 6e 61 6d 65 | 20 73 70 61 63 65 3b 20 |s's name| space; |
|00004020| 5c 76 65 72 62 40 5f 5f | 62 61 73 65 73 5f 5f 40 |\verb@__|bases__@|
|00004030| 20 79 69 65 6c 64 73 20 | 61 20 74 75 70 6c 65 0d | yields |a tuple.|
|00004040| 28 70 6f 73 73 69 62 6c | 79 20 65 6d 70 74 79 20 |(possibl|y empty |
|00004050| 6f 72 20 61 20 73 69 6e | 67 6c 65 74 6f 6e 29 20 |or a sin|gleton) |
|00004060| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 74 68 65 20 62 |containi|ng the b|
|00004070| 61 73 65 20 63 6c 61 73 | 73 65 73 2c 20 69 6e 20 |ase clas|ses, in |
|00004080| 74 68 65 0d 6f 72 64 65 | 72 20 6f 66 20 74 68 65 |the.orde|r of the|
|00004090| 69 72 20 6f 63 63 75 72 | 72 65 6e 63 65 20 69 6e |ir occur|rence in|
|000040a0| 20 74 68 65 20 62 61 73 | 65 20 63 6c 61 73 73 20 | the bas|e class |
|000040b0| 6c 69 73 74 2e 0d 5c 74 | 74 69 6e 64 65 78 7b 5f |list..\t|tindex{_|
|000040c0| 5f 64 69 63 74 5f 5f 7d | 0d 5c 74 74 69 6e 64 65 |_dict__}|.\ttinde|
|000040d0| 78 7b 5f 5f 62 61 73 65 | 73 5f 5f 7d 0d 0d 5c 69 |x{__base|s__}..\i|
|000040e0| 74 65 6d 5b 43 6c 61 73 | 73 20 69 6e 73 74 61 6e |tem[Clas|s instan|
|000040f0| 63 65 73 5d 0d 41 20 63 | 6c 61 73 73 20 69 6e 73 |ces].A c|lass ins|
|00004100| 74 61 6e 63 65 20 69 73 | 20 63 72 65 61 74 65 64 |tance is| created|
|00004110| 20 62 79 20 63 61 6c 6c | 69 6e 67 20 61 20 63 6c | by call|ing a cl|
|00004120| 61 73 73 20 6f 62 6a 65 | 63 74 20 61 73 20 61 0d |ass obje|ct as a.|
|00004130| 66 75 6e 63 74 69 6f 6e | 2e 20 20 41 20 63 6c 61 |function|. A cla|
|00004140| 73 73 20 69 6e 73 74 61 | 6e 63 65 20 68 61 73 20 |ss insta|nce has |
|00004150| 61 20 64 69 63 74 69 6f | 6e 61 72 79 20 69 6e 20 |a dictio|nary in |
|00004160| 77 68 69 63 68 0d 61 74 | 74 72 69 62 75 74 65 20 |which.at|tribute |
|00004170| 72 65 66 65 72 65 6e 63 | 65 73 20 61 72 65 20 73 |referenc|es are s|
|00004180| 65 61 72 63 68 65 64 2e | 20 20 57 68 65 6e 20 61 |earched.| When a|
|00004190| 6e 20 61 74 74 72 69 62 | 75 74 65 20 69 73 20 6e |n attrib|ute is n|
|000041a0| 6f 74 20 66 6f 75 6e 64 | 0d 74 68 65 72 65 2c 20 |ot found|.there, |
|000041b0| 61 6e 64 20 74 68 65 20 | 69 6e 73 74 61 6e 63 65 |and the |instance|
|000041c0| 27 73 20 63 6c 61 73 73 | 20 68 61 73 20 61 6e 20 |'s class| has an |
|000041d0| 61 74 74 72 69 62 75 74 | 65 20 62 79 20 74 68 61 |attribut|e by tha|
|000041e0| 74 20 6e 61 6d 65 2c 20 | 61 6e 64 0d 74 68 61 74 |t name, |and.that|
|000041f0| 20 63 6c 61 73 73 20 61 | 74 74 72 69 62 75 74 65 | class a|ttribute|
|00004200| 20 69 73 20 61 20 75 73 | 65 72 2d 64 65 66 69 6e | is a us|er-defin|
|00004210| 65 64 20 66 75 6e 63 74 | 69 6f 6e 20 28 61 6e 64 |ed funct|ion (and|
|00004220| 20 69 6e 20 6e 6f 20 6f | 74 68 65 72 0d 63 61 73 | in no o|ther.cas|
|00004230| 65 73 29 2c 20 74 68 65 | 20 69 6e 73 74 61 6e 63 |es), the| instanc|
|00004240| 65 20 61 74 74 72 69 62 | 75 74 65 20 72 65 66 65 |e attrib|ute refe|
|00004250| 72 65 6e 63 65 20 79 69 | 65 6c 64 73 20 61 20 75 |rence yi|elds a u|
|00004260| 73 65 72 2d 64 65 66 69 | 6e 65 64 20 6d 65 74 68 |ser-defi|ned meth|
|00004270| 6f 64 0d 6f 62 6a 65 63 | 74 20 28 73 65 65 20 61 |od.objec|t (see a|
|00004280| 62 6f 76 65 29 20 63 6f | 6e 73 74 72 75 63 74 65 |bove) co|nstructe|
|00004290| 64 20 66 72 6f 6d 20 74 | 68 65 20 69 6e 73 74 61 |d from t|he insta|
|000042a0| 6e 63 65 20 61 6e 64 20 | 74 68 65 20 66 75 6e 63 |nce and |the func|
|000042b0| 74 69 6f 6e 2e 0d 5c 6f | 62 69 6e 64 65 78 7b 63 |tion..\o|bindex{c|
|000042c0| 6c 61 73 73 20 69 6e 73 | 74 61 6e 63 65 7d 0d 5c |lass ins|tance}.\|
|000042d0| 6f 62 69 6e 64 65 78 7b | 69 6e 73 74 61 6e 63 65 |obindex{|instance|
|000042e0| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 63 6c 61 73 73 |}.\index|ii{class|
|000042f0| 7d 7b 69 6e 73 74 61 6e | 63 65 7d 0d 5c 69 6e 64 |}{instan|ce}.\ind|
|00004300| 65 78 69 69 7b 63 6c 61 | 73 73 20 69 6e 73 74 61 |exii{cla|ss insta|
|00004310| 6e 63 65 7d 7b 61 74 74 | 72 69 62 75 74 65 7d 0d |nce}{att|ribute}.|
|00004320| 0d 41 74 74 72 69 62 75 | 74 65 20 61 73 73 69 67 |.Attribu|te assig|
|00004330| 6e 6d 65 6e 74 73 20 75 | 70 64 61 74 65 20 74 68 |nments u|pdate th|
|00004340| 65 20 69 6e 73 74 61 6e | 63 65 27 73 20 64 69 63 |e instan|ce's dic|
|00004350| 74 69 6f 6e 61 72 79 2e | 0d 5c 69 6e 64 65 78 69 |tionary.|.\indexi|
|00004360| 69 69 7b 63 6c 61 73 73 | 20 69 6e 73 74 61 6e 63 |ii{class| instanc|
|00004370| 65 7d 7b 61 74 74 72 69 | 62 75 74 65 7d 7b 61 73 |e}{attri|bute}{as|
|00004380| 73 69 67 6e 6d 65 6e 74 | 7d 0d 0d 43 6c 61 73 73 |signment|}..Class|
|00004390| 20 69 6e 73 74 61 6e 63 | 65 73 20 63 61 6e 20 70 | instanc|es can p|
|000043a0| 72 65 74 65 6e 64 20 74 | 6f 20 62 65 20 6e 75 6d |retend t|o be num|
|000043b0| 62 65 72 73 2c 20 73 65 | 71 75 65 6e 63 65 73 2c |bers, se|quences,|
|000043c0| 20 6f 72 20 6d 61 70 70 | 69 6e 67 73 20 69 66 0d | or mapp|ings if.|
|000043d0| 74 68 65 79 20 68 61 76 | 65 20 6d 65 74 68 6f 64 |they hav|e method|
|000043e0| 73 20 77 69 74 68 20 63 | 65 72 74 61 69 6e 20 73 |s with c|ertain s|
|000043f0| 70 65 63 69 61 6c 20 6e | 61 6d 65 73 2e 20 20 54 |pecial n|ames. T|
|00004400| 68 65 73 65 20 61 72 65 | 20 64 65 73 63 72 69 62 |hese are| describ|
|00004410| 65 64 20 69 6e 0d 73 65 | 63 74 69 6f 6e 20 5c 72 |ed in.se|ction \r|
|00004420| 65 66 7b 73 70 65 63 69 | 61 6c 6e 61 6d 65 73 7d |ef{speci|alnames}|
|00004430| 2e 0d 5c 6f 62 69 6e 64 | 65 78 7b 6e 75 6d 62 65 |..\obind|ex{numbe|
|00004440| 72 7d 0d 5c 6f 62 69 6e | 64 65 78 7b 73 65 71 75 |r}.\obin|dex{sequ|
|00004450| 65 6e 63 65 7d 0d 5c 6f | 62 69 6e 64 65 78 7b 6d |ence}.\o|bindex{m|
|00004460| 61 70 70 69 6e 67 7d 0d | 0d 53 70 65 63 69 61 6c |apping}.|.Special|
|00004470| 20 72 65 61 64 2d 6f 6e | 6c 79 20 61 74 74 72 69 | read-on|ly attri|
|00004480| 62 75 74 65 73 3a 20 5c | 76 65 72 62 40 5f 5f 64 |butes: \|verb@__d|
|00004490| 69 63 74 5f 5f 40 20 79 | 69 65 6c 64 73 20 74 68 |ict__@ y|ields th|
|000044a0| 65 20 61 74 74 72 69 62 | 75 74 65 0d 64 69 63 74 |e attrib|ute.dict|
|000044b0| 69 6f 6e 61 72 79 3b 20 | 5c 76 65 72 62 40 5f 5f |ionary; |\verb@__|
|000044c0| 63 6c 61 73 73 5f 5f 40 | 20 79 69 65 6c 64 73 20 |class__@| yields |
|000044d0| 74 68 65 20 69 6e 73 74 | 61 6e 63 65 27 73 20 63 |the inst|ance's c|
|000044e0| 6c 61 73 73 2e 0d 5c 74 | 74 69 6e 64 65 78 7b 5f |lass..\t|tindex{_|
|000044f0| 5f 64 69 63 74 5f 5f 7d | 0d 5c 74 74 69 6e 64 65 |_dict__}|.\ttinde|
|00004500| 78 7b 5f 5f 63 6c 61 73 | 73 5f 5f 7d 0d 0d 5c 69 |x{__clas|s__}..\i|
|00004510| 74 65 6d 5b 46 69 6c 65 | 73 5d 0d 41 20 66 69 6c |tem[File|s].A fil|
|00004520| 65 20 6f 62 6a 65 63 74 | 20 72 65 70 72 65 73 65 |e object| represe|
|00004530| 6e 74 73 20 61 6e 20 6f | 70 65 6e 20 66 69 6c 65 |nts an o|pen file|
|00004540| 2e 20 20 28 49 74 20 69 | 73 20 61 20 77 72 61 70 |. (It i|s a wrap|
|00004550| 70 65 72 20 61 72 6f 75 | 6e 64 20 61 20 43 0d 7b |per arou|nd a C.{|
|00004560| 5c 74 74 20 73 74 64 69 | 6f 7d 20 66 69 6c 65 20 |\tt stdi|o} file |
|00004570| 70 6f 69 6e 74 65 72 2e | 29 20 20 46 69 6c 65 20 |pointer.|) File |
|00004580| 6f 62 6a 65 63 74 73 20 | 61 72 65 20 63 72 65 61 |objects |are crea|
|00004590| 74 65 64 20 62 79 20 74 | 68 65 0d 5c 76 65 72 62 |ted by t|he.\verb|
|000045a0| 40 6f 70 65 6e 28 29 40 | 20 62 75 69 6c 74 2d 69 |@open()@| built-i|
|000045b0| 6e 20 66 75 6e 63 74 69 | 6f 6e 2c 20 61 6e 64 20 |n functi|on, and |
|000045c0| 61 6c 73 6f 20 62 79 20 | 5c 76 65 72 62 40 70 6f |also by |\verb@po|
|000045d0| 73 69 78 2e 70 6f 70 65 | 6e 28 29 40 20 61 6e 64 |six.pope|n()@ and|
|000045e0| 0d 74 68 65 20 5c 76 65 | 72 62 40 6d 61 6b 65 66 |.the \ve|rb@makef|
|000045f0| 69 6c 65 40 20 6d 65 74 | 68 6f 64 20 6f 66 20 73 |ile@ met|hod of s|
|00004600| 6f 63 6b 65 74 20 6f 62 | 6a 65 63 74 73 2e 20 20 |ocket ob|jects. |
|00004610| 5c 76 65 72 62 40 73 79 | 73 2e 73 74 64 69 6e 40 |\verb@sy|s.stdin@|
|00004620| 2c 0d 5c 76 65 72 62 40 | 73 79 73 2e 73 74 64 6f |,.\verb@|sys.stdo|
|00004630| 75 74 40 20 61 6e 64 20 | 5c 76 65 72 62 40 73 79 |ut@ and |\verb@sy|
|00004640| 73 2e 73 74 64 65 72 72 | 40 20 61 72 65 20 66 69 |s.stderr|@ are fi|
|00004650| 6c 65 20 6f 62 6a 65 63 | 74 73 20 63 6f 72 72 65 |le objec|ts corre|
|00004660| 73 70 6f 6e 64 69 6e 67 | 0d 74 68 65 20 74 68 65 |sponding|.the the|
|00004670| 20 69 6e 74 65 72 70 72 | 65 74 65 72 27 73 20 73 | interpr|eter's s|
|00004680| 74 61 6e 64 61 72 64 20 | 69 6e 70 75 74 2c 20 6f |tandard |input, o|
|00004690| 75 74 70 75 74 20 61 6e | 64 20 65 72 72 6f 72 20 |utput an|d error |
|000046a0| 73 74 72 65 61 6d 73 2e | 0d 53 65 65 20 74 68 65 |streams.|.See the|
|000046b0| 20 50 79 74 68 6f 6e 20 | 4c 69 62 72 61 72 79 20 | Python |Library |
|000046c0| 52 65 66 65 72 65 6e 63 | 65 20 66 6f 72 20 6d 65 |Referenc|e for me|
|000046d0| 74 68 6f 64 73 20 6f 66 | 20 66 69 6c 65 20 6f 62 |thods of| file ob|
|000046e0| 6a 65 63 74 73 20 61 6e | 64 20 6f 74 68 65 72 0d |jects an|d other.|
|000046f0| 64 65 74 61 69 6c 73 2e | 0d 5c 6f 62 69 6e 64 65 |details.|.\obinde|
|00004700| 78 7b 66 69 6c 65 7d 0d | 5c 69 6e 64 65 78 7b 43 |x{file}.|\index{C|
|00004710| 7d 0d 5c 69 6e 64 65 78 | 7b 73 74 64 69 6f 7d 0d |}.\index|{stdio}.|
|00004720| 5c 62 69 66 75 6e 63 69 | 6e 64 65 78 7b 6f 70 65 |\bifunci|ndex{ope|
|00004730| 6e 7d 0d 5c 62 69 66 75 | 6e 63 69 6e 64 65 78 7b |n}.\bifu|ncindex{|
|00004740| 70 6f 70 65 6e 7d 0d 5c | 62 69 66 75 6e 63 69 6e |popen}.\|bifuncin|
|00004750| 64 65 78 7b 6d 61 6b 65 | 66 69 6c 65 7d 0d 5c 74 |dex{make|file}.\t|
|00004760| 74 69 6e 64 65 78 7b 73 | 74 64 69 6e 7d 0d 5c 74 |tindex{s|tdin}.\t|
|00004770| 74 69 6e 64 65 78 7b 73 | 74 64 6f 75 74 7d 0d 5c |tindex{s|tdout}.\|
|00004780| 74 74 69 6e 64 65 78 7b | 73 74 64 65 72 72 7d 0d |ttindex{|stderr}.|
|00004790| 5c 74 74 69 6e 64 65 78 | 7b 73 79 73 2e 73 74 64 |\ttindex|{sys.std|
|000047a0| 69 6e 7d 0d 5c 74 74 69 | 6e 64 65 78 7b 73 79 73 |in}.\tti|ndex{sys|
|000047b0| 2e 73 74 64 6f 75 74 7d | 0d 5c 74 74 69 6e 64 65 |.stdout}|.\ttinde|
|000047c0| 78 7b 73 79 73 2e 73 74 | 64 65 72 72 7d 0d 0d 5c |x{sys.st|derr}..\|
|000047d0| 69 74 65 6d 5b 49 6e 74 | 65 72 6e 61 6c 20 74 79 |item[Int|ernal ty|
|000047e0| 70 65 73 5d 0d 41 20 66 | 65 77 20 74 79 70 65 73 |pes].A f|ew types|
|000047f0| 20 75 73 65 64 20 69 6e | 74 65 72 6e 61 6c 6c 79 | used in|ternally|
|00004800| 20 62 79 20 74 68 65 20 | 69 6e 74 65 72 70 72 65 | by the |interpre|
|00004810| 74 65 72 20 61 72 65 20 | 65 78 70 6f 73 65 64 20 |ter are |exposed |
|00004820| 74 6f 20 74 68 65 20 75 | 73 65 72 2e 0d 54 68 65 |to the u|ser..The|
|00004830| 69 72 20 64 65 66 69 6e | 69 74 69 6f 6e 20 6d 61 |ir defin|ition ma|
|00004840| 79 20 63 68 61 6e 67 65 | 20 77 69 74 68 20 66 75 |y change| with fu|
|00004850| 74 75 72 65 20 76 65 72 | 73 69 6f 6e 73 20 6f 66 |ture ver|sions of|
|00004860| 20 74 68 65 20 69 6e 74 | 65 72 70 72 65 74 65 72 | the int|erpreter|
|00004870| 2c 0d 62 75 74 20 74 68 | 65 79 20 61 72 65 20 6d |,.but th|ey are m|
|00004880| 65 6e 74 69 6f 6e 65 64 | 20 68 65 72 65 20 66 6f |entioned| here fo|
|00004890| 72 20 63 6f 6d 70 6c 65 | 74 65 6e 65 73 73 2e 0d |r comple|teness..|
|000048a0| 5c 69 6e 64 65 78 7b 69 | 6e 74 65 72 6e 61 6c 20 |\index{i|nternal |
|000048b0| 74 79 70 65 7d 0d 0d 5c | 62 65 67 69 6e 7b 64 65 |type}..\|begin{de|
|000048c0| 73 63 72 69 70 74 69 6f | 6e 7d 0d 0d 5c 69 74 65 |scriptio|n}..\ite|
|000048d0| 6d 5b 43 6f 64 65 20 6f | 62 6a 65 63 74 73 5d 0d |m[Code o|bjects].|
|000048e0| 43 6f 64 65 20 6f 62 6a | 65 63 74 73 20 72 65 70 |Code obj|ects rep|
|000048f0| 72 65 73 65 6e 74 20 65 | 78 65 63 75 74 61 62 6c |resent e|xecutabl|
|00004900| 65 20 63 6f 64 65 2e 20 | 20 54 68 65 20 64 69 66 |e code. | The dif|
|00004910| 66 65 72 65 6e 63 65 20 | 62 65 74 77 65 65 6e 20 |ference |between |
|00004920| 61 20 63 6f 64 65 0d 6f | 62 6a 65 63 74 20 61 6e |a code.o|bject an|
|00004930| 64 20 61 20 66 75 6e 63 | 74 69 6f 6e 20 6f 62 6a |d a func|tion obj|
|00004940| 65 63 74 20 69 73 20 74 | 68 61 74 20 74 68 65 20 |ect is t|hat the |
|00004950| 66 75 6e 63 74 69 6f 6e | 20 6f 62 6a 65 63 74 20 |function| object |
|00004960| 63 6f 6e 74 61 69 6e 73 | 20 61 6e 0d 65 78 70 6c |contains| an.expl|
|00004970| 69 63 69 74 20 72 65 66 | 65 72 65 6e 63 65 20 74 |icit ref|erence t|
|00004980| 6f 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 27 73 |o the fu|nction's|
|00004990| 20 63 6f 6e 74 65 78 74 | 20 28 74 68 65 20 6d 6f | context| (the mo|
|000049a0| 64 75 6c 65 20 69 6e 20 | 77 68 69 63 68 20 69 74 |dule in |which it|
|000049b0| 0d 77 61 73 20 64 65 66 | 69 6e 65 64 29 20 77 68 |.was def|ined) wh|
|000049c0| 69 63 68 20 61 20 63 6f | 64 65 20 6f 62 6a 65 63 |ich a co|de objec|
|000049d0| 74 20 63 6f 6e 74 61 69 | 6e 73 20 6e 6f 20 63 6f |t contai|ns no co|
|000049e0| 6e 74 65 78 74 2e 20 20 | 54 68 65 72 65 20 69 73 |ntext. |There is|
|000049f0| 20 6e 6f 20 77 61 79 0d | 74 6f 20 65 78 65 63 75 | no way.|to execu|
|00004a00| 74 65 20 61 20 62 61 72 | 65 20 63 6f 64 65 20 6f |te a bar|e code o|
|00004a10| 62 6a 65 63 74 2e 0d 5c | 6f 62 69 6e 64 65 78 7b |bject..\|obindex{|
|00004a20| 63 6f 64 65 7d 0d 0d 53 | 70 65 63 69 61 6c 20 72 |code}..S|pecial r|
|00004a30| 65 61 64 2d 6f 6e 6c 79 | 20 61 74 74 72 69 62 75 |ead-only| attribu|
|00004a40| 74 65 73 3a 20 5c 76 65 | 72 62 40 63 6f 5f 63 6f |tes: \ve|rb@co_co|
|00004a50| 64 65 40 20 69 73 20 61 | 20 73 74 72 69 6e 67 20 |de@ is a| string |
|00004a60| 72 65 70 72 65 73 65 6e | 74 69 6e 67 0d 74 68 65 |represen|ting.the|
|00004a70| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 69 6e 73 | sequenc|e of ins|
|00004a80| 74 72 75 63 74 69 6f 6e | 73 3b 20 5c 76 65 72 62 |truction|s; \verb|
|00004a90| 40 63 6f 5f 63 6f 6e 73 | 74 73 40 20 69 73 20 61 |@co_cons|ts@ is a|
|00004aa0| 20 6c 69 73 74 20 6f 66 | 20 6c 69 74 65 72 61 6c | list of| literal|
|00004ab0| 73 0d 75 73 65 64 20 62 | 79 20 74 68 65 20 63 6f |s.used b|y the co|
|00004ac0| 64 65 3b 20 5c 76 65 72 | 62 40 63 6f 5f 6e 61 6d |de; \ver|b@co_nam|
|00004ad0| 65 73 40 20 69 73 20 61 | 20 6c 69 73 74 20 6f 66 |es@ is a| list of|
|00004ae0| 20 6e 61 6d 65 73 20 28 | 73 74 72 69 6e 67 73 29 | names (|strings)|
|00004af0| 20 75 73 65 64 20 62 79 | 0d 74 68 65 20 63 6f 64 | used by|.the cod|
|00004b00| 65 3b 20 5c 76 65 72 62 | 40 63 6f 5f 66 69 6c 65 |e; \verb|@co_file|
|00004b10| 6e 61 6d 65 40 20 69 73 | 20 74 68 65 20 66 69 6c |name@ is| the fil|
|00004b20| 65 6e 61 6d 65 20 66 72 | 6f 6d 20 77 68 69 63 68 |ename fr|om which|
|00004b30| 20 74 68 65 20 63 6f 64 | 65 20 77 61 73 0d 63 6f | the cod|e was.co|
|00004b40| 6d 70 69 6c 65 64 2e 20 | 20 28 54 6f 20 66 69 6e |mpiled. | (To fin|
|00004b50| 64 20 6f 75 74 20 74 68 | 65 20 6c 69 6e 65 20 6e |d out th|e line n|
|00004b60| 75 6d 62 65 72 73 2c 20 | 79 6f 75 20 77 6f 75 6c |umbers, |you woul|
|00004b70| 64 20 68 61 76 65 20 74 | 6f 20 64 65 63 6f 64 65 |d have t|o decode|
|00004b80| 20 74 68 65 0d 69 6e 73 | 74 72 75 63 74 69 6f 6e | the.ins|truction|
|00004b90| 73 3b 20 74 68 65 20 73 | 74 61 6e 64 61 72 64 20 |s; the s|tandard |
|00004ba0| 6c 69 62 72 61 72 79 20 | 6d 6f 64 75 6c 65 20 5c |library |module \|
|00004bb0| 76 65 72 62 40 64 69 73 | 40 20 63 6f 6e 74 61 69 |verb@dis|@ contai|
|00004bc0| 6e 73 20 61 6e 0d 65 78 | 61 6d 70 6c 65 20 6f 66 |ns an.ex|ample of|
|00004bd0| 20 68 6f 77 20 74 6f 20 | 64 6f 20 74 68 69 73 2e | how to |do this.|
|00004be0| 29 0d 5c 74 74 69 6e 64 | 65 78 7b 63 6f 5f 63 6f |).\ttind|ex{co_co|
|00004bf0| 64 65 7d 0d 5c 74 74 69 | 6e 64 65 78 7b 63 6f 5f |de}.\tti|ndex{co_|
|00004c00| 63 6f 6e 73 74 73 7d 0d | 5c 74 74 69 6e 64 65 78 |consts}.|\ttindex|
|00004c10| 7b 63 6f 5f 6e 61 6d 65 | 73 7d 0d 5c 74 74 69 6e |{co_name|s}.\ttin|
|00004c20| 64 65 78 7b 63 6f 5f 66 | 69 6c 65 6e 61 6d 65 7d |dex{co_f|ilename}|
|00004c30| 0d 0d 5c 69 74 65 6d 5b | 46 72 61 6d 65 20 6f 62 |..\item[|Frame ob|
|00004c40| 6a 65 63 74 73 5d 0d 46 | 72 61 6d 65 20 6f 62 6a |jects].F|rame obj|
|00004c50| 65 63 74 73 20 72 65 70 | 72 65 73 65 6e 74 20 65 |ects rep|resent e|
|00004c60| 78 65 63 75 74 69 6f 6e | 20 66 72 61 6d 65 73 2e |xecution| frames.|
|00004c70| 20 20 54 68 65 79 20 6d | 61 79 20 6f 63 63 75 72 | They m|ay occur|
|00004c80| 20 69 6e 20 74 72 61 63 | 65 62 61 63 6b 0d 6f 62 | in trac|eback.ob|
|00004c90| 6a 65 63 74 73 20 28 73 | 65 65 20 62 65 6c 6f 77 |jects (s|ee below|
|00004ca0| 29 2e 0d 5c 6f 62 69 6e | 64 65 78 7b 66 72 61 6d |)..\obin|dex{fram|
|00004cb0| 65 7d 0d 0d 53 70 65 63 | 69 61 6c 20 72 65 61 64 |e}..Spec|ial read|
|00004cc0| 2d 6f 6e 6c 79 20 61 74 | 74 72 69 62 75 74 65 73 |-only at|tributes|
|00004cd0| 3a 20 5c 76 65 72 62 40 | 66 5f 62 61 63 6b 40 20 |: \verb@|f_back@ |
|00004ce0| 69 73 20 74 6f 20 74 68 | 65 20 70 72 65 76 69 6f |is to th|e previo|
|00004cf0| 75 73 0d 73 74 61 63 6b | 20 66 72 61 6d 65 20 28 |us.stack| frame (|
|00004d00| 74 6f 77 61 72 64 73 20 | 74 68 65 20 63 61 6c 6c |towards |the call|
|00004d10| 65 72 29 2c 20 6f 72 20 | 5c 76 65 72 62 40 4e 6f |er), or |\verb@No|
|00004d20| 6e 65 40 20 69 66 20 74 | 68 69 73 20 69 73 20 74 |ne@ if t|his is t|
|00004d30| 68 65 20 62 6f 74 74 6f | 6d 0d 73 74 61 63 6b 20 |he botto|m.stack |
|00004d40| 66 72 61 6d 65 3b 20 5c | 76 65 72 62 40 66 5f 63 |frame; \|verb@f_c|
|00004d50| 6f 64 65 40 20 69 73 20 | 74 68 65 20 63 6f 64 65 |ode@ is |the code|
|00004d60| 20 6f 62 6a 65 63 74 20 | 62 65 69 6e 67 20 65 78 | object |being ex|
|00004d70| 65 63 75 74 65 64 20 69 | 6e 20 74 68 69 73 0d 66 |ecuted i|n this.f|
|00004d80| 72 61 6d 65 3b 20 5c 76 | 65 72 62 40 66 5f 67 6c |rame; \v|erb@f_gl|
|00004d90| 6f 62 61 6c 73 40 20 69 | 73 20 74 68 65 20 64 69 |obals@ i|s the di|
|00004da0| 63 74 69 6f 6e 61 72 79 | 20 75 73 65 64 20 74 6f |ctionary| used to|
|00004db0| 20 6c 6f 6f 6b 20 75 70 | 20 67 6c 6f 62 61 6c 0d | look up| global.|
|00004dc0| 76 61 72 69 61 62 6c 65 | 73 3b 20 5c 76 65 72 62 |variable|s; \verb|
|00004dd0| 40 66 5f 6c 6f 63 61 6c | 73 40 20 69 73 20 75 73 |@f_local|s@ is us|
|00004de0| 65 64 20 66 6f 72 20 6c | 6f 63 61 6c 20 76 61 72 |ed for l|ocal var|
|00004df0| 69 61 62 6c 65 73 3b 0d | 5c 76 65 72 62 40 66 5f |iables;.|\verb@f_|
|00004e00| 6c 69 6e 65 6e 6f 40 20 | 67 69 76 65 73 20 74 68 |lineno@ |gives th|
|00004e10| 65 20 6c 69 6e 65 20 6e | 75 6d 62 65 72 20 61 6e |e line n|umber an|
|00004e20| 64 20 5c 76 65 72 62 40 | 66 5f 6c 61 73 74 69 40 |d \verb@|f_lasti@|
|00004e30| 20 67 69 76 65 73 20 74 | 68 65 0d 70 72 65 63 69 | gives t|he.preci|
|00004e40| 73 65 20 69 6e 73 74 72 | 75 63 74 69 6f 6e 20 28 |se instr|uction (|
|00004e50| 74 68 69 73 20 69 73 20 | 61 6e 20 69 6e 64 65 78 |this is |an index|
|00004e60| 20 69 6e 74 6f 20 74 68 | 65 20 69 6e 73 74 72 75 | into th|e instru|
|00004e70| 63 74 69 6f 6e 20 73 74 | 72 69 6e 67 20 6f 66 0d |ction st|ring of.|
|00004e80| 74 68 65 20 63 6f 64 65 | 20 6f 62 6a 65 63 74 29 |the code| object)|
|00004e90| 2e 0d 5c 74 74 69 6e 64 | 65 78 7b 66 5f 62 61 63 |..\ttind|ex{f_bac|
|00004ea0| 6b 7d 0d 5c 74 74 69 6e | 64 65 78 7b 66 5f 63 6f |k}.\ttin|dex{f_co|
|00004eb0| 64 65 7d 0d 5c 74 74 69 | 6e 64 65 78 7b 66 5f 67 |de}.\tti|ndex{f_g|
|00004ec0| 6c 6f 62 61 6c 73 7d 0d | 5c 74 74 69 6e 64 65 78 |lobals}.|\ttindex|
|00004ed0| 7b 66 5f 6c 6f 63 61 6c | 73 7d 0d 5c 74 74 69 6e |{f_local|s}.\ttin|
|00004ee0| 64 65 78 7b 66 5f 6c 69 | 6e 65 6e 6f 7d 0d 5c 74 |dex{f_li|neno}.\t|
|00004ef0| 74 69 6e 64 65 78 7b 66 | 5f 6c 61 73 74 69 7d 0d |tindex{f|_lasti}.|
|00004f00| 0d 5c 69 74 65 6d 5b 54 | 72 61 63 65 62 61 63 6b |.\item[T|raceback|
|00004f10| 20 6f 62 6a 65 63 74 73 | 5d 20 5c 6c 61 62 65 6c | objects|] \label|
|00004f20| 7b 74 72 61 63 65 62 61 | 63 6b 7d 0d 54 72 61 63 |{traceba|ck}.Trac|
|00004f30| 65 62 61 63 6b 20 6f 62 | 6a 65 63 74 73 20 72 65 |eback ob|jects re|
|00004f40| 70 72 65 73 65 6e 74 20 | 61 20 73 74 61 63 6b 20 |present |a stack |
|00004f50| 74 72 61 63 65 20 6f 66 | 20 61 6e 20 65 78 63 65 |trace of| an exce|
|00004f60| 70 74 69 6f 6e 2e 20 20 | 41 0d 74 72 61 63 65 62 |ption. |A.traceb|
|00004f70| 61 63 6b 20 6f 62 6a 65 | 63 74 20 69 73 20 63 72 |ack obje|ct is cr|
|00004f80| 65 61 74 65 64 20 77 68 | 65 6e 20 61 6e 20 65 78 |eated wh|en an ex|
|00004f90| 63 65 70 74 69 6f 6e 20 | 6f 63 63 75 72 73 2e 20 |ception |occurs. |
|00004fa0| 20 57 68 65 6e 20 74 68 | 65 20 73 65 61 72 63 68 | When th|e search|
|00004fb0| 0d 66 6f 72 20 61 6e 20 | 65 78 63 65 70 74 69 6f |.for an |exceptio|
|00004fc0| 6e 20 68 61 6e 64 6c 65 | 72 20 75 6e 77 69 6e 64 |n handle|r unwind|
|00004fd0| 73 20 74 68 65 20 65 78 | 65 63 75 74 69 6f 6e 20 |s the ex|ecution |
|00004fe0| 73 74 61 63 6b 2c 20 61 | 74 20 65 61 63 68 20 75 |stack, a|t each u|
|00004ff0| 6e 77 6f 75 6e 64 0d 6c | 65 76 65 6c 20 61 20 74 |nwound.l|evel a t|
|00005000| 72 61 63 65 62 61 63 6b | 20 6f 62 6a 65 63 74 20 |raceback| object |
|00005010| 69 73 20 69 6e 73 65 72 | 74 65 64 20 69 6e 20 66 |is inser|ted in f|
|00005020| 72 6f 6e 74 20 6f 66 20 | 74 68 65 20 63 75 72 72 |ront of |the curr|
|00005030| 65 6e 74 0d 74 72 61 63 | 65 62 61 63 6b 2e 20 20 |ent.trac|eback. |
|00005040| 57 68 65 6e 20 61 6e 20 | 65 78 63 65 70 74 69 6f |When an |exceptio|
|00005050| 6e 20 68 61 6e 64 6c 65 | 72 20 69 73 20 65 6e 74 |n handle|r is ent|
|00005060| 65 72 65 64 0d 28 73 65 | 65 20 61 6c 73 6f 20 73 |ered.(se|e also s|
|00005070| 65 63 74 69 6f 6e 20 5c | 72 65 66 7b 74 72 79 7d |ection \|ref{try}|
|00005080| 29 2c 20 74 68 65 20 73 | 74 61 63 6b 20 74 72 61 |), the s|tack tra|
|00005090| 63 65 20 69 73 0d 6d 61 | 64 65 20 61 76 61 69 6c |ce is.ma|de avail|
|000050a0| 61 62 6c 65 20 74 6f 20 | 74 68 65 20 70 72 6f 67 |able to |the prog|
|000050b0| 72 61 6d 20 61 73 20 5c | 76 65 72 62 40 73 79 73 |ram as \|verb@sys|
|000050c0| 2e 65 78 63 5f 74 72 61 | 63 65 62 61 63 6b 40 2e |.exc_tra|ceback@.|
|000050d0| 20 20 57 68 65 6e 20 74 | 68 65 0d 70 72 6f 67 72 | When t|he.progr|
|000050e0| 61 6d 20 63 6f 6e 74 61 | 69 6e 73 20 6e 6f 20 73 |am conta|ins no s|
|000050f0| 75 69 74 61 62 6c 65 20 | 68 61 6e 64 6c 65 72 2c |uitable |handler,|
|00005100| 20 74 68 65 20 73 74 61 | 63 6b 20 74 72 61 63 65 | the sta|ck trace|
|00005110| 20 69 73 20 77 72 69 74 | 74 65 6e 0d 28 6e 69 63 | is writ|ten.(nic|
|00005120| 65 6c 79 20 66 6f 72 6d | 61 74 74 65 64 29 20 74 |ely form|atted) t|
|00005130| 6f 20 74 68 65 20 73 74 | 61 6e 64 61 72 64 20 65 |o the st|andard e|
|00005140| 72 72 6f 72 20 73 74 72 | 65 61 6d 3b 20 69 66 20 |rror str|eam; if |
|00005150| 74 68 65 20 69 6e 74 65 | 72 70 72 65 74 65 72 20 |the inte|rpreter |
|00005160| 69 73 0d 69 6e 74 65 72 | 61 63 74 69 76 65 2c 20 |is.inter|active, |
|00005170| 69 74 20 69 73 20 61 6c | 73 6f 20 6d 61 64 65 20 |it is al|so made |
|00005180| 61 76 61 69 6c 61 62 6c | 65 20 74 6f 20 74 68 65 |availabl|e to the|
|00005190| 20 75 73 65 72 20 61 73 | 0d 5c 76 65 72 62 40 73 | user as|.\verb@s|
|000051a0| 79 73 2e 6c 61 73 74 5f | 74 72 61 63 65 62 61 63 |ys.last_|tracebac|
|000051b0| 6b 40 2e 0d 5c 6f 62 69 | 6e 64 65 78 7b 74 72 61 |k@..\obi|ndex{tra|
|000051c0| 63 65 62 61 63 6b 7d 0d | 5c 69 6e 64 65 78 69 69 |ceback}.|\indexii|
|000051d0| 7b 73 74 61 63 6b 7d 7b | 74 72 61 63 65 7d 0d 5c |{stack}{|trace}.\|
|000051e0| 69 6e 64 65 78 69 69 7b | 65 78 63 65 70 74 69 6f |indexii{|exceptio|
|000051f0| 6e 7d 7b 68 61 6e 64 6c | 65 72 7d 0d 5c 69 6e 64 |n}{handl|er}.\ind|
|00005200| 65 78 69 69 7b 65 78 65 | 63 75 74 69 6f 6e 7d 7b |exii{exe|cution}{|
|00005210| 73 74 61 63 6b 7d 0d 5c | 74 74 69 6e 64 65 78 7b |stack}.\|ttindex{|
|00005220| 65 78 63 5f 74 72 61 63 | 65 62 61 63 6b 7d 0d 5c |exc_trac|eback}.\|
|00005230| 74 74 69 6e 64 65 78 7b | 6c 61 73 74 5f 74 72 61 |ttindex{|last_tra|
|00005240| 63 65 62 61 63 6b 7d 0d | 5c 74 74 69 6e 64 65 78 |ceback}.|\ttindex|
|00005250| 7b 73 79 73 2e 65 78 63 | 5f 74 72 61 63 65 62 61 |{sys.exc|_traceba|
|00005260| 63 6b 7d 0d 5c 74 74 69 | 6e 64 65 78 7b 73 79 73 |ck}.\tti|ndex{sys|
|00005270| 2e 6c 61 73 74 5f 74 72 | 61 63 65 62 61 63 6b 7d |.last_tr|aceback}|
|00005280| 0d 0d 53 70 65 63 69 61 | 6c 20 72 65 61 64 2d 6f |..Specia|l read-o|
|00005290| 6e 6c 79 20 61 74 74 72 | 69 62 75 74 65 73 3a 20 |nly attr|ibutes: |
|000052a0| 5c 76 65 72 62 40 74 62 | 5f 6e 65 78 74 40 20 69 |\verb@tb|_next@ i|
|000052b0| 73 20 74 68 65 20 6e 65 | 78 74 20 6c 65 76 65 6c |s the ne|xt level|
|000052c0| 20 69 6e 20 74 68 65 0d | 73 74 61 63 6b 20 74 72 | in the.|stack tr|
|000052d0| 61 63 65 20 28 74 6f 77 | 61 72 64 73 20 74 68 65 |ace (tow|ards the|
|000052e0| 20 66 72 61 6d 65 20 77 | 68 65 72 65 20 74 68 65 | frame w|here the|
|000052f0| 20 65 78 63 65 70 74 69 | 6f 6e 20 6f 63 63 75 72 | excepti|on occur|
|00005300| 72 65 64 29 2c 20 6f 72 | 0d 5c 76 65 72 62 40 4e |red), or|.\verb@N|
|00005310| 6f 6e 65 40 20 69 66 20 | 74 68 65 72 65 20 69 73 |one@ if |there is|
|00005320| 20 6e 6f 20 6e 65 78 74 | 20 6c 65 76 65 6c 3b 20 | no next| level; |
|00005330| 5c 76 65 72 62 40 74 62 | 5f 66 72 61 6d 65 40 20 |\verb@tb|_frame@ |
|00005340| 70 6f 69 6e 74 73 20 74 | 6f 20 74 68 65 0d 65 78 |points t|o the.ex|
|00005350| 65 63 75 74 69 6f 6e 20 | 66 72 61 6d 65 20 6f 66 |ecution |frame of|
|00005360| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 6c 65 76 | the cur|rent lev|
|00005370| 65 6c 3b 20 5c 76 65 72 | 62 40 74 62 5f 6c 69 6e |el; \ver|b@tb_lin|
|00005380| 65 6e 6f 40 20 67 69 76 | 65 73 20 74 68 65 20 6c |eno@ giv|es the l|
|00005390| 69 6e 65 0d 6e 75 6d 62 | 65 72 20 77 68 65 72 65 |ine.numb|er where|
|000053a0| 20 74 68 65 20 65 78 63 | 65 70 74 69 6f 6e 20 6f | the exc|eption o|
|000053b0| 63 63 75 72 72 65 64 3b | 20 5c 76 65 72 62 40 74 |ccurred;| \verb@t|
|000053c0| 62 5f 6c 61 73 74 69 40 | 20 69 6e 64 69 63 61 74 |b_lasti@| indicat|
|000053d0| 65 73 20 74 68 65 0d 70 | 72 65 63 69 73 65 20 69 |es the.p|recise i|
|000053e0| 6e 73 74 72 75 63 74 69 | 6f 6e 2e 20 20 54 68 65 |nstructi|on. The|
|000053f0| 20 6c 69 6e 65 20 6e 75 | 6d 62 65 72 20 61 6e 64 | line nu|mber and|
|00005400| 20 6c 61 73 74 20 69 6e | 73 74 72 75 63 74 69 6f | last in|structio|
|00005410| 6e 20 69 6e 20 74 68 65 | 0d 74 72 61 63 65 62 61 |n in the|.traceba|
|00005420| 63 6b 20 6d 61 79 20 64 | 69 66 66 65 72 20 66 72 |ck may d|iffer fr|
|00005430| 6f 6d 20 74 68 65 20 6c | 69 6e 65 20 6e 75 6d 62 |om the l|ine numb|
|00005440| 65 72 20 6f 66 20 69 74 | 73 20 66 72 61 6d 65 20 |er of it|s frame |
|00005450| 6f 62 6a 65 63 74 20 69 | 66 20 74 68 65 0d 65 78 |object i|f the.ex|
|00005460| 63 65 70 74 69 6f 6e 20 | 6f 63 63 75 72 72 65 64 |ception |occurred|
|00005470| 20 69 6e 20 61 20 5c 76 | 65 72 62 40 74 72 79 40 | in a \v|erb@try@|
|00005480| 20 73 74 61 74 65 6d 65 | 6e 74 20 77 69 74 68 20 | stateme|nt with |
|00005490| 6e 6f 20 6d 61 74 63 68 | 69 6e 67 0d 5c 76 65 72 |no match|ing.\ver|
|000054a0| 62 40 65 78 63 65 70 74 | 40 20 63 6c 61 75 73 65 |b@except|@ clause|
|000054b0| 20 6f 72 20 77 69 74 68 | 20 61 20 5c 76 65 72 62 | or with| a \verb|
|000054c0| 40 66 69 6e 61 6c 6c 79 | 40 20 63 6c 61 75 73 65 |@finally|@ clause|
|000054d0| 2e 0d 5c 74 74 69 6e 64 | 65 78 7b 74 62 5f 6e 65 |..\ttind|ex{tb_ne|
|000054e0| 78 74 7d 0d 5c 74 74 69 | 6e 64 65 78 7b 74 62 5f |xt}.\tti|ndex{tb_|
|000054f0| 66 72 61 6d 65 7d 0d 5c | 74 74 69 6e 64 65 78 7b |frame}.\|ttindex{|
|00005500| 74 62 5f 6c 69 6e 65 6e | 6f 7d 0d 5c 74 74 69 6e |tb_linen|o}.\ttin|
|00005510| 64 65 78 7b 74 62 5f 6c | 61 73 74 69 7d 0d 5c 73 |dex{tb_l|asti}.\s|
|00005520| 74 69 6e 64 65 78 7b 74 | 72 79 7d 0d 0d 5c 65 6e |tindex{t|ry}..\en|
|00005530| 64 7b 64 65 73 63 72 69 | 70 74 69 6f 6e 7d 20 25 |d{descri|ption} %|
|00005540| 20 49 6e 74 65 72 6e 61 | 6c 20 74 79 70 65 73 0d | Interna|l types.|
|00005550| 0d 5c 65 6e 64 7b 64 65 | 73 63 72 69 70 74 69 6f |.\end{de|scriptio|
|00005560| 6e 7d 20 25 20 54 79 70 | 65 73 0d 0d 0d 5c 73 65 |n} % Typ|es...\se|
|00005570| 63 74 69 6f 6e 7b 53 70 | 65 63 69 61 6c 20 6d 65 |ction{Sp|ecial me|
|00005580| 74 68 6f 64 20 6e 61 6d | 65 73 7d 20 5c 6c 61 62 |thod nam|es} \lab|
|00005590| 65 6c 7b 73 70 65 63 69 | 61 6c 6e 61 6d 65 73 7d |el{speci|alnames}|
|000055a0| 0d 0d 41 20 63 6c 61 73 | 73 20 63 61 6e 20 69 6d |..A clas|s can im|
|000055b0| 70 6c 65 6d 65 6e 74 20 | 63 65 72 74 61 69 6e 20 |plement |certain |
|000055c0| 6f 70 65 72 61 74 69 6f | 6e 73 20 74 68 61 74 20 |operatio|ns that |
|000055d0| 61 72 65 20 69 6e 76 6f | 6b 65 64 20 62 79 20 73 |are invo|ked by s|
|000055e0| 70 65 63 69 61 6c 0d 73 | 79 6e 74 61 78 20 28 73 |pecial.s|yntax (s|
|000055f0| 75 63 68 20 61 73 20 73 | 75 62 73 63 72 69 70 74 |uch as s|ubscript|
|00005600| 69 6f 6e 20 6f 72 20 61 | 72 69 74 68 6d 65 74 69 |ion or a|rithmeti|
|00005610| 63 20 6f 70 65 72 61 74 | 69 6f 6e 73 29 20 62 79 |c operat|ions) by|
|00005620| 20 64 65 66 69 6e 69 6e | 67 0d 6d 65 74 68 6f 64 | definin|g.method|
|00005630| 73 20 77 69 74 68 20 73 | 70 65 63 69 61 6c 20 6e |s with s|pecial n|
|00005640| 61 6d 65 73 2e 20 20 46 | 6f 72 20 69 6e 73 74 61 |ames. F|or insta|
|00005650| 6e 63 65 2c 20 69 66 20 | 61 20 63 6c 61 73 73 20 |nce, if |a class |
|00005660| 64 65 66 69 6e 65 73 20 | 61 0d 6d 65 74 68 6f 64 |defines |a.method|
|00005670| 20 6e 61 6d 65 64 20 5c | 76 65 72 62 40 5f 5f 67 | named \|verb@__g|
|00005680| 65 74 69 74 65 6d 5f 5f | 40 2c 20 61 6e 64 20 5c |etitem__|@, and \|
|00005690| 76 65 72 62 40 78 40 20 | 69 73 20 61 6e 20 69 6e |verb@x@ |is an in|
|000056a0| 73 74 61 6e 63 65 20 6f | 66 20 74 68 69 73 0d 63 |stance o|f this.c|
|000056b0| 6c 61 73 73 2c 20 74 68 | 65 6e 20 5c 76 65 72 62 |lass, th|en \verb|
|000056c0| 40 78 5b 69 5d 40 20 69 | 73 20 65 71 75 69 76 61 |@x[i]@ i|s equiva|
|000056d0| 6c 65 6e 74 20 74 6f 20 | 5c 76 65 72 62 40 78 2e |lent to |\verb@x.|
|000056e0| 5f 5f 67 65 74 69 74 65 | 6d 5f 5f 28 69 29 40 2e |__getite|m__(i)@.|
|000056f0| 0d 28 54 68 65 20 72 65 | 76 65 72 73 65 20 69 73 |.(The re|verse is|
|00005700| 20 6e 6f 74 20 74 72 75 | 65 20 2d 2d 2d 20 69 66 | not tru|e --- if|
|00005710| 20 5c 76 65 72 62 40 78 | 40 20 69 73 20 61 20 6c | \verb@x|@ is a l|
|00005720| 69 73 74 20 6f 62 6a 65 | 63 74 2c 0d 5c 76 65 72 |ist obje|ct,.\ver|
|00005730| 62 40 78 2e 5f 5f 67 65 | 74 69 74 65 6d 5f 5f 28 |b@x.__ge|titem__(|
|00005740| 69 29 40 20 69 73 20 6e | 6f 74 20 65 71 75 69 76 |i)@ is n|ot equiv|
|00005750| 61 6c 65 6e 74 20 74 6f | 20 5c 76 65 72 62 40 78 |alent to| \verb@x|
|00005760| 5b 69 5d 40 2e 29 0d 0d | 45 78 63 65 70 74 20 66 |[i]@.)..|Except f|
|00005770| 6f 72 20 5c 76 65 72 62 | 40 5f 5f 72 65 70 72 5f |or \verb|@__repr_|
|00005780| 5f 40 2c 20 5c 76 65 72 | 62 40 5f 5f 73 74 72 5f |_@, \ver|b@__str_|
|00005790| 5f 40 20 61 6e 64 20 5c | 76 65 72 62 40 5f 5f 63 |_@ and \|verb@__c|
|000057a0| 6d 70 5f 5f 40 2c 0d 61 | 74 74 65 6d 70 74 73 20 |mp__@,.a|ttempts |
|000057b0| 74 6f 20 65 78 65 63 75 | 74 65 20 61 6e 0d 6f 70 |to execu|te an.op|
|000057c0| 65 72 61 74 69 6f 6e 20 | 72 61 69 73 65 20 61 6e |eration |raise an|
|000057d0| 20 65 78 63 65 70 74 69 | 6f 6e 20 77 68 65 6e 20 | excepti|on when |
|000057e0| 6e 6f 20 61 70 70 72 6f | 70 72 69 61 74 65 20 6d |no appro|priate m|
|000057f0| 65 74 68 6f 64 20 69 73 | 20 64 65 66 69 6e 65 64 |ethod is| defined|
|00005800| 2e 0d 46 6f 72 20 5c 76 | 65 72 62 40 5f 5f 72 65 |..For \v|erb@__re|
|00005810| 70 72 5f 5f 40 2c 20 74 | 68 65 20 64 65 66 61 75 |pr__@, t|he defau|
|00005820| 6c 74 20 69 73 20 74 6f | 20 72 65 74 75 72 6e 20 |lt is to| return |
|00005830| 61 20 73 74 72 69 6e 67 | 20 64 65 73 63 72 69 62 |a string| describ|
|00005840| 69 6e 67 20 74 68 65 0d | 6f 62 6a 65 63 74 27 73 |ing the.|object's|
|00005850| 20 63 6c 61 73 73 20 61 | 6e 64 20 61 64 64 72 65 | class a|nd addre|
|00005860| 73 73 2e 0d 46 6f 72 20 | 5c 76 65 72 62 40 5f 5f |ss..For |\verb@__|
|00005870| 63 6d 70 5f 5f 40 2c 20 | 74 68 65 20 64 65 66 61 |cmp__@, |the defa|
|00005880| 75 6c 74 20 69 73 20 74 | 6f 20 63 6f 6d 70 61 72 |ult is t|o compar|
|00005890| 65 20 69 6e 73 74 61 6e | 63 65 73 20 62 61 73 65 |e instan|ces base|
|000058a0| 64 20 6f 6e 20 74 68 65 | 69 72 0d 61 64 64 72 65 |d on the|ir.addre|
|000058b0| 73 73 2e 0d 46 6f 72 20 | 5c 76 65 72 62 40 5f 5f |ss..For |\verb@__|
|000058c0| 73 74 72 5f 5f 40 2c 20 | 74 68 65 20 64 65 66 61 |str__@, |the defa|
|000058d0| 75 6c 74 20 69 73 20 74 | 6f 20 75 73 65 20 5c 76 |ult is t|o use \v|
|000058e0| 65 72 62 40 5f 5f 72 65 | 70 72 5f 5f 40 2e 0d 0d |erb@__re|pr__@...|
|000058f0| 0d 5c 73 75 62 73 65 63 | 74 69 6f 6e 7b 53 70 65 |.\subsec|tion{Spe|
|00005900| 63 69 61 6c 20 6d 65 74 | 68 6f 64 73 20 66 6f 72 |cial met|hods for|
|00005910| 20 61 6e 79 20 74 79 70 | 65 7d 0d 0d 5c 62 65 67 | any typ|e}..\beg|
|00005920| 69 6e 7b 64 65 73 63 72 | 69 70 74 69 6f 6e 7d 0d |in{descr|iption}.|
|00005930| 0d 5c 69 74 65 6d 5b 5c | 74 74 20 5f 5f 69 6e 69 |.\item[\|tt __ini|
|00005940| 74 5f 5f 28 73 65 6c 66 | 2c 20 61 72 67 73 2e 2e |t__(self|, args..|
|00005950| 2e 29 5d 0d 43 61 6c 6c | 65 64 20 77 68 65 6e 20 |.)].Call|ed when |
|00005960| 74 68 65 20 69 6e 73 74 | 61 6e 63 65 20 69 73 20 |the inst|ance is |
|00005970| 63 72 65 61 74 65 64 2e | 20 20 54 68 65 20 61 72 |created.| The ar|
|00005980| 67 75 6d 65 6e 74 73 20 | 61 72 65 20 74 68 6f 73 |guments |are thos|
|00005990| 65 20 70 61 73 73 65 64 | 0d 74 6f 20 74 68 65 20 |e passed|.to the |
|000059a0| 63 6c 61 73 73 20 63 6f | 6e 73 74 72 75 63 74 6f |class co|nstructo|
|000059b0| 72 20 65 78 70 72 65 73 | 73 69 6f 6e 2e 20 20 49 |r expres|sion. I|
|000059c0| 66 20 61 20 62 61 73 65 | 20 63 6c 61 73 73 20 68 |f a base| class h|
|000059d0| 61 73 20 61 6e 0d 5c 63 | 6f 64 65 7b 5f 5f 69 6e |as an.\c|ode{__in|
|000059e0| 69 74 5f 5f 7d 20 6d 65 | 74 68 6f 64 20 74 68 65 |it__} me|thod the|
|000059f0| 20 64 65 72 69 76 65 64 | 20 63 6c 61 73 73 27 73 | derived| class's|
|00005a00| 20 5c 63 6f 64 65 7b 5f | 5f 69 6e 69 74 5f 5f 7d | \code{_|_init__}|
|00005a10| 20 6d 65 74 68 6f 64 20 | 6d 75 73 74 0d 65 78 70 | method |must.exp|
|00005a20| 6c 69 63 69 74 6c 79 20 | 63 61 6c 6c 20 69 74 20 |licitly |call it |
|00005a30| 74 6f 20 65 6e 73 75 72 | 65 20 70 72 6f 70 65 72 |to ensur|e proper|
|00005a40| 20 69 6e 69 74 69 61 6c | 69 7a 61 74 69 6f 6e 20 | initial|ization |
|00005a50| 6f 66 20 74 68 65 20 62 | 61 73 65 20 63 6c 61 73 |of the b|ase clas|
|00005a60| 73 0d 70 61 72 74 20 6f | 66 20 74 68 65 20 69 6e |s.part o|f the in|
|00005a70| 73 74 61 6e 63 65 2e 0d | 0d 5c 69 74 65 6d 5b 5c |stance..|.\item[\|
|00005a80| 74 74 20 5f 5f 64 65 6c | 5f 5f 28 73 65 6c 66 29 |tt __del|__(self)|
|00005a90| 5d 0d 43 61 6c 6c 65 64 | 20 77 68 65 6e 20 74 68 |].Called| when th|
|00005aa0| 65 20 69 6e 73 74 61 6e | 63 65 20 69 73 20 61 62 |e instan|ce is ab|
|00005ab0| 6f 75 74 20 74 6f 20 62 | 65 20 64 65 73 74 72 6f |out to b|e destro|
|00005ac0| 79 65 64 2e 20 20 49 66 | 20 61 20 62 61 73 65 20 |yed. If| a base |
|00005ad0| 63 6c 61 73 73 0d 68 61 | 73 20 61 6e 20 5c 63 6f |class.ha|s an \co|
|00005ae0| 64 65 7b 5f 5f 64 65 6c | 5f 5f 7d 20 6d 65 74 68 |de{__del|__} meth|
|00005af0| 6f 64 20 74 68 65 20 64 | 65 72 69 76 65 64 20 63 |od the d|erived c|
|00005b00| 6c 61 73 73 27 73 20 5c | 63 6f 64 65 7b 5f 5f 64 |lass's \|code{__d|
|00005b10| 65 6c 5f 5f 7d 20 6d 65 | 74 68 6f 64 0d 6d 75 73 |el__} me|thod.mus|
|00005b20| 74 20 65 78 70 6c 69 63 | 69 74 6c 79 20 63 61 6c |t explic|itly cal|
|00005b30| 6c 20 69 74 20 74 6f 20 | 65 6e 73 75 72 65 20 70 |l it to |ensure p|
|00005b40| 72 6f 70 65 72 20 64 65 | 6c 65 74 69 6f 6e 20 6f |roper de|letion o|
|00005b50| 66 20 74 68 65 20 62 61 | 73 65 20 63 6c 61 73 73 |f the ba|se class|
|00005b60| 0d 70 61 72 74 20 6f 66 | 20 74 68 65 20 69 6e 73 |.part of| the ins|
|00005b70| 74 61 6e 63 65 2e 20 20 | 4e 6f 74 65 20 74 68 61 |tance. |Note tha|
|00005b80| 74 20 69 74 20 69 73 20 | 70 6f 73 73 69 62 6c 65 |t it is |possible|
|00005b90| 20 66 6f 72 20 74 68 65 | 20 5c 63 6f 64 65 7b 5f | for the| \code{_|
|00005ba0| 5f 64 65 6c 5f 5f 7d 0d | 6d 65 74 68 6f 64 20 74 |_del__}.|method t|
|00005bb0| 6f 20 70 6f 73 74 70 6f | 6e 65 20 64 65 73 74 72 |o postpo|ne destr|
|00005bc0| 75 63 74 69 6f 6e 20 6f | 66 20 74 68 65 20 69 6e |uction o|f the in|
|00005bd0| 73 74 61 6e 63 65 20 62 | 79 20 63 72 65 61 74 69 |stance b|y creati|
|00005be0| 6e 67 20 61 20 6e 65 77 | 0d 72 65 66 65 72 65 6e |ng a new|.referen|
|00005bf0| 63 65 20 74 6f 20 69 74 | 2e 20 20 49 74 20 6d 61 |ce to it|. It ma|
|00005c00| 79 20 74 68 65 6e 20 62 | 65 20 63 61 6c 6c 65 64 |y then b|e called|
|00005c10| 20 61 74 20 61 20 6c 61 | 74 65 72 20 74 69 6d 65 | at a la|ter time|
|00005c20| 20 77 68 65 6e 20 74 68 | 69 73 20 6e 65 77 0d 72 | when th|is new.r|
|00005c30| 65 66 65 72 65 6e 63 65 | 20 69 73 20 64 65 6c 65 |eference| is dele|
|00005c40| 74 65 64 2e 20 20 49 74 | 20 69 73 20 6e 6f 74 20 |ted. It| is not |
|00005c50| 67 75 61 72 61 6e 74 65 | 65 64 20 74 68 61 74 0d |guarante|ed that.|
|00005c60| 5c 63 6f 64 65 7b 5f 5f | 64 65 6c 5f 5f 7d 20 6d |\code{__|del__} m|
|00005c70| 65 74 68 6f 64 73 20 61 | 72 65 20 63 61 6c 6c 65 |ethods a|re calle|
|00005c80| 64 20 66 6f 72 20 6f 62 | 6a 65 63 74 73 20 74 68 |d for ob|jects th|
|00005c90| 61 74 20 73 74 69 6c 6c | 20 65 78 69 73 74 20 77 |at still| exist w|
|00005ca0| 68 65 6e 0d 74 68 65 20 | 69 6e 74 65 72 70 72 65 |hen.the |interpre|
|00005cb0| 74 65 72 20 65 78 69 74 | 73 2e 0d 0d 4e 6f 74 65 |ter exit|s...Note|
|00005cc0| 20 74 68 61 74 20 5c 63 | 6f 64 65 7b 64 65 6c 20 | that \c|ode{del |
|00005cd0| 78 7d 20 64 6f 65 73 6e | 27 74 20 64 69 72 65 63 |x} doesn|'t direc|
|00005ce0| 74 6c 79 20 63 61 6c 6c | 20 5c 63 6f 64 65 7b 78 |tly call| \code{x|
|00005cf0| 2e 5f 5f 64 65 6c 5f 5f | 7d 20 2d 2d 20 74 68 65 |.__del__|} -- the|
|00005d00| 0d 66 6f 72 6d 65 72 20 | 64 65 63 72 65 6d 65 6e |.former |decremen|
|00005d10| 74 73 20 74 68 65 20 72 | 65 66 65 72 65 6e 63 65 |ts the r|eference|
|00005d20| 20 63 6f 75 6e 74 20 66 | 6f 72 20 5c 63 6f 64 65 | count f|or \code|
|00005d30| 7b 78 7d 20 62 79 20 6f | 6e 65 2c 20 62 75 74 0d |{x} by o|ne, but.|
|00005d40| 5c 63 6f 64 65 7b 78 2c | 5f 5f 64 65 6c 5f 5f 7d |\code{x,|__del__}|
|00005d50| 20 69 73 20 6f 6e 6c 79 | 20 63 61 6c 6c 65 64 20 | is only| called |
|00005d60| 77 68 65 6e 20 69 74 73 | 20 72 65 66 65 72 65 6e |when its| referen|
|00005d70| 63 65 20 63 6f 75 6e 74 | 20 72 65 61 63 68 65 73 |ce count| reaches|
|00005d80| 20 7a 65 72 6f 2e 0d 0d | 5c 69 74 65 6d 5b 5c 74 | zero...|\item[\t|
|00005d90| 74 20 5f 5f 72 65 70 72 | 5f 5f 28 73 65 6c 66 29 |t __repr|__(self)|
|00005da0| 5d 0d 43 61 6c 6c 65 64 | 20 62 79 20 74 68 65 20 |].Called| by the |
|00005db0| 5c 76 65 72 62 40 72 65 | 70 72 28 29 40 20 62 75 |\verb@re|pr()@ bu|
|00005dc0| 69 6c 74 2d 69 6e 20 66 | 75 6e 63 74 69 6f 6e 20 |ilt-in f|unction |
|00005dd0| 61 6e 64 20 62 79 20 63 | 6f 6e 76 65 72 73 69 6f |and by c|onversio|
|00005de0| 6e 73 0d 28 72 65 76 65 | 72 73 65 20 71 75 6f 74 |ns.(reve|rse quot|
|00005df0| 65 73 29 20 74 6f 20 63 | 6f 6d 70 75 74 65 20 74 |es) to c|ompute t|
|00005e00| 68 65 20 73 74 72 69 6e | 67 20 72 65 70 72 65 73 |he strin|g repres|
|00005e10| 65 6e 74 61 74 69 6f 6e | 20 6f 66 20 61 6e 20 6f |entation| of an o|
|00005e20| 62 6a 65 63 74 2e 0d 0d | 5c 69 74 65 6d 5b 5c 74 |bject...|\item[\t|
|00005e30| 74 20 5f 5f 73 74 72 5f | 5f 28 73 65 6c 66 29 5d |t __str_|_(self)]|
|00005e40| 0d 43 61 6c 6c 65 64 20 | 62 79 20 74 68 65 20 5c |.Called |by the \|
|00005e50| 76 65 72 62 40 73 74 72 | 28 29 40 20 62 75 69 6c |verb@str|()@ buil|
|00005e60| 74 2d 69 6e 20 66 75 6e | 63 74 69 6f 6e 20 61 6e |t-in fun|ction an|
|00005e70| 64 20 62 79 20 74 68 65 | 20 5c 76 65 72 62 40 70 |d by the| \verb@p|
|00005e80| 72 69 6e 74 40 0d 73 74 | 61 74 65 6d 65 6e 74 20 |rint@.st|atement |
|00005e90| 63 6f 6d 70 75 74 65 20 | 74 68 65 20 73 74 72 69 |compute |the stri|
|00005ea0| 6e 67 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |ng repre|sentatio|
|00005eb0| 6e 20 6f 66 20 61 6e 20 | 6f 62 6a 65 63 74 2e 0d |n of an |object..|
|00005ec0| 0d 5c 69 74 65 6d 5b 5c | 74 74 20 5f 5f 63 6d 70 |.\item[\|tt __cmp|
|00005ed0| 5f 5f 28 73 65 6c 66 2c | 20 6f 74 68 65 72 29 5d |__(self,| other)]|
|00005ee0| 0d 43 61 6c 6c 65 64 20 | 62 79 20 61 6c 6c 20 63 |.Called |by all c|
|00005ef0| 6f 6d 70 61 72 69 73 6f | 6e 20 6f 70 65 72 61 74 |ompariso|n operat|
|00005f00| 69 6f 6e 73 2e 20 20 53 | 68 6f 75 6c 64 20 72 65 |ions. S|hould re|
|00005f10| 74 75 72 6e 20 2d 31 20 | 69 66 0d 5c 76 65 72 62 |turn -1 |if.\verb|
|00005f20| 40 73 65 6c 66 20 3c 20 | 6f 74 68 65 72 40 2c 20 |@self < |other@, |
|00005f30| 20 30 20 69 66 20 5c 76 | 65 72 62 40 73 65 6c 66 | 0 if \v|erb@self|
|00005f40| 20 3d 3d 20 6f 74 68 65 | 72 40 2c 20 2b 31 20 69 | == othe|r@, +1 i|
|00005f50| 66 0d 5c 76 65 72 62 40 | 73 65 6c 66 20 3e 20 6f |f.\verb@|self > o|
|00005f60| 74 68 65 72 40 2e 20 20 | 49 66 20 6e 6f 20 5c 63 |ther@. |If no \c|
|00005f70| 6f 64 65 7b 5f 5f 63 6d | 70 5f 5f 7d 20 6f 70 65 |ode{__cm|p__} ope|
|00005f80| 72 61 74 69 6f 6e 20 69 | 73 20 64 65 66 69 6e 65 |ration i|s define|
|00005f90| 64 2c 20 63 6c 61 73 73 | 0d 69 6e 73 74 61 6e 63 |d, class|.instanc|
|00005fa0| 65 73 20 61 72 65 20 63 | 6f 6d 70 61 72 65 64 20 |es are c|ompared |
|00005fb0| 62 79 20 6f 62 6a 65 63 | 74 20 69 64 65 6e 74 69 |by objec|t identi|
|00005fc0| 74 79 20 28 60 60 61 64 | 64 72 65 73 73 27 27 29 |ty (``ad|dress'')|
|00005fd0| 2e 0d 28 49 6d 70 6c 65 | 6d 65 6e 74 61 74 69 6f |..(Imple|mentatio|
|00005fe0| 6e 20 6e 6f 74 65 3a 20 | 64 75 65 20 74 6f 20 6c |n note: |due to l|
|00005ff0| 69 6d 69 74 61 74 69 6f | 6e 73 20 69 6e 20 74 68 |imitatio|ns in th|
|00006000| 65 20 69 6e 74 65 72 70 | 72 65 74 65 72 2c 0d 65 |e interp|reter,.e|
|00006010| 78 63 65 70 74 69 6f 6e | 73 20 72 61 69 73 65 64 |xception|s raised|
|00006020| 20 62 79 20 63 6f 6d 70 | 61 72 69 73 6f 6e 73 20 | by comp|arisons |
|00006030| 61 72 65 20 69 67 6e 6f | 72 65 64 2c 20 61 6e 64 |are igno|red, and|
|00006040| 20 74 68 65 20 6f 62 6a | 65 63 74 73 20 77 69 6c | the obj|ects wil|
|00006050| 6c 20 62 65 0d 63 6f 6e | 73 69 64 65 72 65 64 20 |l be.con|sidered |
|00006060| 65 71 75 61 6c 20 69 6e | 20 74 68 69 73 20 63 61 |equal in| this ca|
|00006070| 73 65 2e 29 0d 0d 5c 69 | 74 65 6d 5b 5c 74 74 20 |se.)..\i|tem[\tt |
|00006080| 5f 5f 68 61 73 68 5f 5f | 28 73 65 6c 66 29 5d 0d |__hash__|(self)].|
|00006090| 43 61 6c 6c 65 64 20 66 | 6f 72 20 74 68 65 20 6b |Called f|or the k|
|000060a0| 65 79 20 6f 62 6a 65 63 | 74 20 66 6f 72 20 64 69 |ey objec|t for di|
|000060b0| 63 74 69 6f 6e 61 72 79 | 20 6f 70 65 72 61 74 69 |ctionary| operati|
|000060c0| 6f 6e 73 2c 0d 61 6e 64 | 20 62 79 20 74 68 65 20 |ons,.and| by the |
|000060d0| 62 75 69 6c 74 2d 69 6e | 20 66 75 6e 63 74 69 6f |built-in| functio|
|000060e0| 6e 0d 5c 63 6f 64 65 7b | 68 61 73 68 28 29 7d 2e |n.\code{|hash()}.|
|000060f0| 20 20 53 68 6f 75 6c 64 | 20 72 65 74 75 72 6e 20 | Should| return |
|00006100| 61 20 33 32 2d 62 69 74 | 20 69 6e 74 65 67 65 72 |a 32-bit| integer|
|00006110| 20 75 73 61 62 6c 65 20 | 61 73 20 61 20 68 61 73 | usable |as a has|
|00006120| 68 20 76 61 6c 75 65 0d | 66 6f 72 20 64 69 63 74 |h value.|for dict|
|00006130| 69 6f 6e 61 72 79 20 6f | 70 65 72 61 74 69 6f 6e |ionary o|peration|
|00006140| 73 2e 20 20 54 68 65 20 | 6f 6e 6c 79 20 72 65 71 |s. The |only req|
|00006150| 75 69 72 65 64 20 70 72 | 6f 70 65 72 74 79 20 69 |uired pr|operty i|
|00006160| 73 20 74 68 61 74 20 6f | 62 6a 65 63 74 73 0d 77 |s that o|bjects.w|
|00006170| 68 69 63 68 20 63 6f 6d | 70 61 72 65 20 65 71 75 |hich com|pare equ|
|00006180| 61 6c 20 68 61 76 65 20 | 74 68 65 20 73 61 6d 65 |al have |the same|
|00006190| 20 68 61 73 68 20 76 61 | 6c 75 65 3b 20 69 74 20 | hash va|lue; it |
|000061a0| 69 73 20 61 64 76 69 73 | 65 64 20 74 6f 20 73 6f |is advis|ed to so|
|000061b0| 6d 65 68 6f 77 0d 6d 69 | 78 20 74 6f 67 65 74 68 |mehow.mi|x togeth|
|000061c0| 65 72 20 28 65 2e 67 2e | 20 75 73 69 6e 67 20 65 |er (e.g.| using e|
|000061d0| 78 63 6c 75 73 69 6e 67 | 20 6f 72 29 20 74 68 65 |xclusing| or) the|
|000061e0| 20 68 61 73 68 20 76 61 | 6c 75 65 73 20 66 6f 72 | hash va|lues for|
|000061f0| 20 74 68 65 0d 63 6f 6d | 70 6f 6e 65 6e 74 73 20 | the.com|ponents |
|00006200| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 20 74 68 |of the o|bject th|
|00006210| 61 74 20 61 6c 73 6f 20 | 70 6c 61 79 20 61 20 70 |at also |play a p|
|00006220| 61 72 74 20 69 6e 20 63 | 6f 6d 70 61 72 69 73 6f |art in c|ompariso|
|00006230| 6e 20 6f 66 0d 6f 62 6a | 65 63 74 73 2e 20 20 49 |n of.obj|ects. I|
|00006240| 66 20 61 20 63 6c 61 73 | 73 20 64 6f 65 73 20 6e |f a clas|s does n|
|00006250| 6f 74 20 64 65 66 69 6e | 65 20 61 20 5c 63 6f 64 |ot defin|e a \cod|
|00006260| 65 7b 5f 5f 63 6d 70 5f | 5f 7d 20 6d 65 74 68 6f |e{__cmp_|_} metho|
|00006270| 64 20 69 74 20 73 68 6f | 75 6c 64 0d 6e 6f 74 20 |d it sho|uld.not |
|00006280| 64 65 66 69 6e 65 20 61 | 20 5c 63 6f 64 65 7b 5f |define a| \code{_|
|00006290| 5f 68 61 73 68 5f 5f 7d | 20 6f 70 65 72 61 74 69 |_hash__}| operati|
|000062a0| 6f 6e 20 65 69 74 68 65 | 72 3b 20 69 66 20 69 74 |on eithe|r; if it|
|000062b0| 20 64 65 66 69 6e 65 73 | 0d 5c 63 6f 64 65 7b 5f | defines|.\code{_|
|000062c0| 5f 63 6d 70 5f 5f 7d 20 | 62 75 74 20 6e 6f 74 20 |_cmp__} |but not |
|000062d0| 5c 63 6f 64 65 7b 5f 5f | 68 61 73 68 5f 5f 7d 20 |\code{__|hash__} |
|000062e0| 69 74 73 20 69 6e 73 74 | 61 6e 63 65 73 20 77 69 |its inst|ances wi|
|000062f0| 6c 6c 20 6e 6f 74 20 62 | 65 0d 75 73 61 62 6c 65 |ll not b|e.usable|
|00006300| 20 61 73 20 64 69 63 74 | 69 6f 6e 61 72 79 20 6b | as dict|ionary k|
|00006310| 65 79 73 2e 20 20 49 66 | 20 61 20 63 6c 61 73 73 |eys. If| a class|
|00006320| 20 64 65 66 69 6e 65 73 | 20 6d 75 74 61 62 6c 65 | defines| mutable|
|00006330| 20 6f 62 6a 65 63 74 73 | 20 61 6e 64 0d 69 6d 70 | objects| and.imp|
|00006340| 6c 65 6d 65 6e 74 73 20 | 61 20 5c 63 6f 64 65 7b |lements |a \code{|
|00006350| 5f 5f 63 6d 70 5f 5f 7d | 20 6d 65 74 68 6f 64 20 |__cmp__}| method |
|00006360| 69 74 20 73 68 6f 75 6c | 64 20 6e 6f 74 20 69 6d |it shoul|d not im|
|00006370| 70 6c 65 6d 65 6e 74 0d | 5c 63 6f 64 65 7b 5f 5f |plement.|\code{__|
|00006380| 68 61 73 68 5f 5f 7d 2c | 20 73 69 6e 63 65 20 74 |hash__},| since t|
|00006390| 68 65 20 64 69 63 74 69 | 6f 6e 61 72 79 20 69 6d |he dicti|onary im|
|000063a0| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 20 61 73 73 |plementa|tion ass|
|000063b0| 75 6d 65 73 20 74 68 61 | 74 20 61 0d 6b 65 79 27 |umes tha|t a.key'|
|000063c0| 73 20 68 61 73 68 20 76 | 61 6c 75 65 20 69 73 20 |s hash v|alue is |
|000063d0| 61 20 63 6f 6e 73 74 61 | 6e 74 2e 0d 5c 6f 62 69 |a consta|nt..\obi|
|000063e0| 6e 64 65 78 7b 64 69 63 | 74 69 6f 6e 61 72 79 7d |ndex{dic|tionary}|
|000063f0| 0d 0d 5c 69 74 65 6d 5b | 5c 74 74 20 5f 5f 63 61 |..\item[|\tt __ca|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.